From bfd2f53d051607b05f4f369003365ca366420942 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Thu, 15 Aug 2019 08:23:26 -0500 Subject: [PATCH 1/4] Implemented use of dependencyManagement and pluginManagement in root POM, and switched to slf4j for core sdk. --- libraries/bot-builder/pom.xml | 504 ++++++++---------- .../bot/builder/TraceTranscriptLogger.java | 6 +- .../builder/TranscriptLoggerMiddleware.java | 18 +- .../bot/builder/TranscriptMiddlewareTest.java | 6 +- libraries/bot-connector/pom.xml | 485 ++++++++--------- .../implementation/ConnectorClientImpl.java | 4 +- .../connector/JwtTokenValidationTests.java | 18 + libraries/bot-schema/pom.xml | 88 +-- pom.xml | 310 ++++++++--- samples/bot-connector-sample/pom.xml | 7 +- samples/servlet-echo/pom.xml | 6 +- samples/spring-echo/pom.xml | 6 +- 12 files changed, 758 insertions(+), 700 deletions(-) create mode 100644 libraries/bot-connector/src/test/java/com/microsoft/bot/connector/JwtTokenValidationTests.java diff --git a/libraries/bot-builder/pom.xml b/libraries/bot-builder/pom.xml index 300e984a4..4d0696e65 100644 --- a/libraries/bot-builder/pom.xml +++ b/libraries/bot-builder/pom.xml @@ -1,282 +1,232 @@ - 4.0.0 - com.microsoft.bot - bot-builder - jar - 4.0-SNAPSHOT - - - ${project.groupId}:${project.artifactId} - Bot Framework Connector - https://dev.botframework.com/ - - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - - - Bot Framework Development - - Microsoft - https://dev.botframework.com/ - - - - - scm:git:https://github.com/Microsoft/botbuilder-java - scm:git:https://github.com/Microsoft/botbuilder-java - https://github.com/Microsoft/botbuilder-java - - - - UTF-8 - false - - - - - junit - junit - 4.12 - test - - - - org.apache.logging.log4j - log4j-api - 2.11.0 - - - - org.slf4j - slf4j-log4j12 - 1.7.25 - test - - - - org.apache.logging.log4j - log4j-core - 2.11.0 - + 4.0.0 - - com.microsoft.rest - client-runtime - 1.2.1 - - - com.microsoft.azure - azure-client-runtime - 1.2.1 - - - com.microsoft.azure - azure-client-authentication - 1.2.1 - - - com.fasterxml.jackson.module - jackson-module-parameter-names - 2.9.2 - - - com.fasterxml.jackson.datatype - jackson-datatype-jdk8 - 2.9.2 - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - 2.9.2 - - - com.auth0 - java-jwt - 3.3.0 - - - com.auth0 - jwks-rsa - 0.3.0 - - - com.microsoft.bot - bot-schema - 4.0.0-SNAPSHOT - - - com.microsoft.bot - bot-connector - 4.0.0-SNAPSHOT - - - - - - MyGet - ${repo.url} - - - - - - MyGet - ${repo.url} - - - - - - build - - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-jar-plugin - 2.1 - - - - true - - - - - - org.eluder.coveralls - coveralls-maven-plugin - 4.3.0 - - yourcoverallsprojectrepositorytoken - - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - ../../cobertura-report/bot-builder - xml - 256m - - true - - - - org.apache.maven.plugins - maven-pmd-plugin - - true - - **/** - - - - - - - - - publish - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://oss.sonatype.org/ - true - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.1 - - - - true - true - - - - - - - - + + com.microsoft.bot + bot-java + 4.0.0 + ../../pom.xml + + + bot-builder + jar + 4.0-SNAPSHOT + + ${project.groupId}:${project.artifactId} + Bot Framework Connector + https://dev.botframework.com/ + + + + MIT License + http://www.opensource.org/licenses/mit-license.php + + + + + + Bot Framework Development + + Microsoft + https://dev.botframework.com/ + + + + + scm:git:https://github.com/Microsoft/botbuilder-java + scm:git:https://github.com/Microsoft/botbuilder-java + https://github.com/Microsoft/botbuilder-java + + + + UTF-8 + false + + + + + junit + junit + + + + org.slf4j + slf4j-api + + + + com.microsoft.rest + client-runtime + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-client-authentication + + + com.fasterxml.jackson.module + jackson-module-parameter-names + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.auth0 + java-jwt + + + com.auth0 + jwks-rsa + + + + com.microsoft.bot + bot-schema + 4.0.0-SNAPSHOT + + + com.microsoft.bot + bot-connector + 4.0.0-SNAPSHOT + + + + + + MyGet + ${repo.url} + + + + + + MyGet + ${repo.url} + + + + + + build + + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + org.apache.maven.plugins + maven-pmd-plugin + + true + + **/** + + + + + + org.eluder.coveralls + coveralls-maven-plugin + + yourcoverallsprojectrepositorytoken + + + + org.codehaus.mojo + cobertura-maven-plugin + + ../../cobertura-report/bot-builder + xml + 256m + + true + + + + + + + + publish + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.sonatype.plugins + nexus-staging-maven-plugin + true + + ossrh + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + + + + + + diff --git a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/TraceTranscriptLogger.java b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/TraceTranscriptLogger.java index a61cd54e4..34b67f8ae 100644 --- a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/TraceTranscriptLogger.java +++ b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/TraceTranscriptLogger.java @@ -9,8 +9,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.microsoft.bot.schema.models.Activity; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.concurrent.ExecutorService; import java.util.concurrent.ForkJoinPool; @@ -23,7 +23,7 @@ public class TraceTranscriptLogger implements TranscriptLogger { // https://github.com/FasterXML/jackson-databind/wiki/Serialization-Features private static ObjectMapper mapper = new ObjectMapper() .enable(SerializationFeature.INDENT_OUTPUT); - private static final Logger logger = LogManager.getLogger("HelloWorld"); + private static final Logger logger = LoggerFactory.getLogger(TraceTranscriptLogger.class); ForkJoinPool.ForkJoinWorkerThreadFactory factory = new ForkJoinPool.ForkJoinWorkerThreadFactory() { diff --git a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/TranscriptLoggerMiddleware.java b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/TranscriptLoggerMiddleware.java index 57562e332..1cae34104 100644 --- a/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/TranscriptLoggerMiddleware.java +++ b/libraries/bot-builder/src/main/java/com/microsoft/bot/builder/TranscriptLoggerMiddleware.java @@ -12,8 +12,8 @@ import com.microsoft.bot.schema.models.ActivityTypes; import com.microsoft.bot.schema.models.ResourceResponse; import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -34,8 +34,8 @@ public class TranscriptLoggerMiddleware implements Middleware { mapper.findAndRegisterModules(); } - private TranscriptLogger logger; - private static final Logger log4j = LogManager.getLogger("BotFx"); + private TranscriptLogger transcriptLogger; + private static final Logger logger = LoggerFactory.getLogger(TranscriptLoggerMiddleware.class); private Queue transcript = new ConcurrentLinkedQueue(); @@ -48,7 +48,7 @@ public TranscriptLoggerMiddleware(TranscriptLogger transcriptLogger) { if (transcriptLogger == null) throw new NullPointerException("TranscriptLoggerMiddleware requires a ITranscriptLogger implementation. "); - this.logger = transcriptLogger; + this.transcriptLogger = transcriptLogger; } @@ -134,12 +134,12 @@ public void OnTurn(TurnContext context, NextDelegate next) throws Exception { try { if (nextDel != null) { - log4j.error(String.format("Transcript logActivity next delegate: %s)", nextDel)); + logger.error(String.format("Transcript logActivity next delegate: %s)", nextDel)); nextDel.run(); } } catch (Exception e) { e.printStackTrace(); - log4j.error(String.format("Transcript logActivity failed with %s (next delegate: %s)", e.toString(), nextDel)); + logger.error(String.format("Transcript logActivity failed with %s (next delegate: %s)", e.toString(), nextDel)); throw new RuntimeException(String.format("Transcript logActivity failed with %s", e.getMessage())); } @@ -169,9 +169,9 @@ public void OnTurn(TurnContext context, NextDelegate next) throws Exception { while (!transcript.isEmpty()) { Activity activity = transcript.poll(); try { - this.logger.LogActivityAsync(activity); + this.transcriptLogger.LogActivityAsync(activity); } catch (RuntimeException err) { - log4j.error(String.format("Transcript poll failed : %1$s", err)); + logger.error(String.format("Transcript poll failed : %1$s", err)); } } diff --git a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java index e9cbb3ec8..aad6e6840 100644 --- a/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java +++ b/libraries/bot-builder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java @@ -7,12 +7,9 @@ import com.fasterxml.jackson.datatype.joda.JodaModule; import com.microsoft.bot.builder.adapters.TestAdapter; import com.microsoft.bot.builder.adapters.TestFlow; -import com.microsoft.bot.builder.dialogs.Dialog; import com.microsoft.bot.schema.ActivityImpl; import com.microsoft.bot.schema.models.*; import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.junit.Assert; import org.junit.Test; @@ -99,7 +96,6 @@ public void next() throws Exception { @Test public final void Transcript_LogActivities() throws ExecutionException, InterruptedException { - Logger logger = LogManager.getLogger(Dialog.class); MemoryTranscriptStore transcriptStore = new MemoryTranscriptStore(); TestAdapter adapter = (new TestAdapter()).Use(new TranscriptLoggerMiddleware(transcriptStore)); final String[] conversationId = {null}; @@ -206,7 +202,7 @@ public void Transcript_LogUpdateActivities() throws InterruptedException, Execut Assert.assertEquals(4, pagedResult.getItems().length); Assert.assertEquals("foo", ((Activity)pagedResult.getItems()[0]).text()); Assert.assertEquals( "response", ((Activity)pagedResult.getItems()[1]).text()); - // TODO: Fix the following 3 asserts so they work correctly. They succeed in the travis builds and fail in the + // TODO: Fix the following 3 asserts so they work correctly. They succeed in the travis builds and fail in the // BotBuilder-Java 4.0 master build. //Assert.assertEquals( "new response", ((Activity)pagedResult.getItems()[2]).text()); //Assert.assertEquals("update", ((Activity)pagedResult.getItems()[3]).text()); diff --git a/libraries/bot-connector/pom.xml b/libraries/bot-connector/pom.xml index f85a02fbb..301dfdc1f 100644 --- a/libraries/bot-connector/pom.xml +++ b/libraries/bot-connector/pom.xml @@ -1,268 +1,227 @@ - 4.0.0 - com.microsoft.bot - bot-connector - jar - 4.0.0-SNAPSHOT - - - ${project.groupId}:${project.artifactId} - Bot Framework Connector - https://dev.botframework.com/ - - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - - - Bot Framework Development - - Microsoft - https://dev.botframework.com/ - - - - - scm:git:https://github.com/Microsoft/botbuilder-java - scm:git:https://github.com/Microsoft/botbuilder-java - https://github.com/Microsoft/botbuilder-java - - - - UTF-8 - false - - - - - junit - junit - 4.12 - test - - - com.microsoft.rest - client-runtime - 1.2.1 - - - com.microsoft.azure - azure-client-runtime - 1.2.1 - - - com.microsoft.azure - azure-client-authentication - 1.2.1 - - - com.fasterxml.jackson.module - jackson-module-parameter-names - 2.9.2 - - - com.fasterxml.jackson.datatype - jackson-datatype-jdk8 - 2.9.2 - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - 2.9.2 - - - com.auth0 - java-jwt - 3.3.0 - - - com.auth0 - jwks-rsa - 0.3.0 - - - com.microsoft.bot - bot-schema - 4.0.0-SNAPSHOT - - - - - - - MyGet - ${repo.url} - - + 4.0.0 - - - MyGet - ${repo.url} - - - - - - build - - true - - - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.1 - - - - true - true - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - org.eluder.coveralls - coveralls-maven-plugin - 4.3.0 - - yourcoverallsprojectrepositorytoken - - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - ../../cobertura-report/bot-connector - xml - 256m - - true - - - - org.apache.maven.plugins - maven-pmd-plugin - - - validate - - check - - - - - - - - - - - publish - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://oss.sonatype.org/ - true - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.1 - - - - true - true - - - - - - - - + + com.microsoft.bot + bot-java + 4.0.0 + ../../pom.xml + + + bot-connector + jar + 4.0.0-SNAPSHOT + + ${project.groupId}:${project.artifactId} + Bot Framework Connector + https://dev.botframework.com/ + + + + MIT License + http://www.opensource.org/licenses/mit-license.php + + + + + + Bot Framework Development + + Microsoft + https://dev.botframework.com/ + + + + + scm:git:https://github.com/Microsoft/botbuilder-java + scm:git:https://github.com/Microsoft/botbuilder-java + https://github.com/Microsoft/botbuilder-java + + + + UTF-8 + false + + + + + junit + junit + + + com.microsoft.rest + client-runtime + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-client-authentication + + + com.microsoft.azure + adal4j + + + com.fasterxml.jackson.module + jackson-module-parameter-names + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.auth0 + java-jwt + + + com.auth0 + jwks-rsa + + + + com.microsoft.bot + bot-schema + 4.0.0-SNAPSHOT + + + + + + MyGet + ${repo.url} + + + + + + MyGet + ${repo.url} + + + + + + build + + true + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + org.apache.maven.plugins + maven-pmd-plugin + + + + org.eluder.coveralls + coveralls-maven-plugin + + yourcoverallsprojectrepositorytoken + + + + org.codehaus.mojo + cobertura-maven-plugin + + ../../cobertura-report/bot-connector + xml + 256m + + true + + + + + + + + + publish + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.sonatype.plugins + nexus-staging-maven-plugin + true + + ossrh + https://oss.sonatype.org/ + true + + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + + + + + + diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/implementation/ConnectorClientImpl.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/implementation/ConnectorClientImpl.java index bcc2204a4..e46eca1d3 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/implementation/ConnectorClientImpl.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/implementation/ConnectorClientImpl.java @@ -221,9 +221,9 @@ public String userAgent() { * This is a copy of what the Azure Client does to create a RestClient. This returns * a RestClient.Builder so that the app can create a custom RestClient, and supply * it to ConnectorClient during construction. - * + * * One use case of this is for supplying a Proxy to the RestClient. - * + * * @param baseUrl * @param credentials * @return diff --git a/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/JwtTokenValidationTests.java b/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/JwtTokenValidationTests.java new file mode 100644 index 000000000..0a934b147 --- /dev/null +++ b/libraries/bot-connector/src/test/java/com/microsoft/bot/connector/JwtTokenValidationTests.java @@ -0,0 +1,18 @@ +package com.microsoft.bot.connector; + +import com.microsoft.bot.connector.authentication.MicrosoftAppCredentials; +import org.junit.Assert; +import org.junit.Test; + +public class JwtTokenValidationTests { + @Test + public void Connector_AuthHeader_CorrectAppIdAndServiceUrl_ShouldValidate() + { +// MicrosoftAppCredentials credentials = new MicrosoftAppCredentials("2cd87869-38a0-4182-9251-d056e8f0ac24", "2.30Vs3VQLKt974F"); +// String header = "Bearer " + credentials. +// var credentials = new SimpleCredentialProvider("2cd87869-38a0-4182-9251-d056e8f0ac24", string.Empty); +// var result = await JwtTokenValidation.ValidateAuthHeader(header, credentials, new SimpleChannelProvider(), string.Empty, "https://webchat.botframework.com/", client); +// +// Assert.True(result.IsAuthenticated); + } +} diff --git a/libraries/bot-schema/pom.xml b/libraries/bot-schema/pom.xml index b8490b902..c728a4252 100644 --- a/libraries/bot-schema/pom.xml +++ b/libraries/bot-schema/pom.xml @@ -1,13 +1,19 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - com.microsoft.bot + + com.microsoft.bot + bot-java + 4.0.0 + ../../pom.xml + + bot-schema jar 4.0.0-SNAPSHOT - ${project.groupId}:${project.artifactId} Bot Framework Schema https://dev.botframework.com/ @@ -43,35 +49,27 @@ junit junit - 4.12 - test com.fasterxml.jackson.module jackson-module-parameter-names - 2.9.5 com.fasterxml.jackson.datatype jackson-datatype-jdk8 - 2.9.5 com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.9.5 - - joda-time - joda-time - 2.10.3 - - - org.apache.commons - commons-lang3 - 3.9 - compile - + + joda-time + joda-time + + + org.apache.commons + commons-lang3 + @@ -92,23 +90,22 @@ build - true + true org.apache.maven.plugins maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - + + org.apache.maven.plugins + maven-pmd-plugin + + org.eluder.coveralls coveralls-maven-plugin - 4.3.0 yourcoverallsprojectrepositorytoken @@ -116,7 +113,6 @@ org.codehaus.mojo cobertura-maven-plugin - 2.7 ../../cobertura-report/bot-schema xml @@ -125,21 +121,8 @@ true - - org.apache.maven.plugins - maven-pmd-plugin - - - validate - - check - - - - - @@ -150,17 +133,15 @@ org.apache.maven.plugins maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - + + + org.apache.maven.plugins + maven-javadoc-plugin org.sonatype.plugins nexus-staging-maven-plugin - 1.6.7 true ossrh @@ -168,11 +149,9 @@ true - org.apache.maven.plugins maven-gpg-plugin - 1.6 sign-artifacts @@ -183,7 +162,6 @@ - org.apache.maven.plugins maven-source-plugin @@ -197,18 +175,6 @@ - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - diff --git a/pom.xml b/pom.xml index 987092737..c01b5950e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,34 +1,129 @@ + 4.0.0 + com.microsoft.bot - bot-parent + bot-java 4.0.0 - pom - Microsoft BotBuilder SDK Parent - This package contains the parent module of Microsoft BotBuilder SDK. + Microsoft BotBuilder Java SDK Parent + This package contains the parent module of Microsoft BotBuilder Java SDK. https://github.com/Microsoft/botbuilder-java UTF-8 true + 1.8 + https://botbuilder.myget.org/F/scratch/maven/ - build - - true - - - - - + build + + true + + + + + + + + + + junit + junit + 4.12 + test + + + com.microsoft.rest + client-runtime + 1.6.12 + + + com.microsoft.azure + azure-client-runtime + 1.6.12 + + + com.microsoft.azure + azure-client-authentication + 1.6.12 + + + com.microsoft.azure + adal4j + 1.6.2 + + + com.fasterxml.jackson.module + jackson-module-parameter-names + 2.9.8 + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + 2.9.8 + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.9.8 + + + com.auth0 + java-jwt + 3.3.0 + + + com.auth0 + jwks-rsa + 0.3.0 + + + org.slf4j + slf4j-api + 1.7.22 + + + joda-time + joda-time + 2.10.3 + + + org.apache.commons + commons-lang3 + 3.4 + + + + org.apache.logging.log4j + log4j-api + 2.11.0 + test + + + org.slf4j + slf4j-log4j12 + 1.7.25 + test + + + org.apache.logging.log4j + log4j-core + 2.11.0 + test + + + + + libraries/bot-schema libraries/bot-builder @@ -39,67 +134,140 @@ - - - org.eluder.coveralls - coveralls-maven-plugin - 4.3.0 - - - - ./cobertura-report/bot-builder/coverage.xml - - - ./cobertura-report/bot-schema/coverage.xml - - - ./cobertura-report/bot-connector/coverage.xml - - - ./cobertura-report/bot-connector-sample/coverage.xml - - + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + ${jdk.version} + ${jdk.version} + + + + org.apache.maven.plugins + maven-jar-plugin + 2.1 + + + + true + true + + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.12.0 + + true + true + false + + + + validate + + check + + + + - UTF-8 - ${env.COVERALLS_GIT_BRANCH} - ${env.COVERALLS_PULL_REQUEST} - ${env.COVERALLS_SERVICE_BUILD_NUMBER} - ${env.COVERALLS_SERVICE_BUILD_URL} - ${env.COVERALLS_SERVICE_JOB_ID} - ${env.COVERALLS_SERVICE_NAME} - - + + org.eluder.coveralls + coveralls-maven-plugin + 4.3.0 + + + + ./cobertura-report/bot-builder/coverage.xml + + + ./cobertura-report/bot-schema/coverage.xml + + + ./cobertura-report/bot-connector/coverage.xml + + + ./cobertura-report/bot-connector-sample/coverage.xml + + - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - xml - - true - - - - - org.apache.maven.plugins - maven-pmd-plugin - 3.12.0 - - true - true - - - - validate - - check - - - - - + UTF-8 + ${env.COVERALLS_GIT_BRANCH} + ${env.COVERALLS_PULL_REQUEST} + ${env.COVERALLS_SERVICE_BUILD_NUMBER} + ${env.COVERALLS_SERVICE_BUILD_URL} + ${env.COVERALLS_SERVICE_JOB_ID} + ${env.COVERALLS_SERVICE_NAME} + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + + xml + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + + + + diff --git a/samples/bot-connector-sample/pom.xml b/samples/bot-connector-sample/pom.xml index 1a098b5e1..48bc76770 100644 --- a/samples/bot-connector-sample/pom.xml +++ b/samples/bot-connector-sample/pom.xml @@ -26,17 +26,17 @@ com.fasterxml.jackson.module jackson-module-parameter-names - 2.9.2 + 2.9.8 com.fasterxml.jackson.datatype jackson-datatype-jdk8 - 2.9.2 + 2.9.8 com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.9.2 + 2.9.8 org.slf4j @@ -128,6 +128,7 @@ org.apache.maven.plugins maven-pmd-plugin + 3.12.0 true diff --git a/samples/servlet-echo/pom.xml b/samples/servlet-echo/pom.xml index 98b1760e9..288689bd8 100644 --- a/samples/servlet-echo/pom.xml +++ b/samples/servlet-echo/pom.xml @@ -49,17 +49,17 @@ com.fasterxml.jackson.module jackson-module-parameter-names - 2.9.2 + 2.9.8 com.fasterxml.jackson.datatype jackson-datatype-jdk8 - 2.9.2 + 2.9.8 com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.9.2 + 2.9.8 org.slf4j diff --git a/samples/spring-echo/pom.xml b/samples/spring-echo/pom.xml index 87b442219..d916b955b 100644 --- a/samples/spring-echo/pom.xml +++ b/samples/spring-echo/pom.xml @@ -72,17 +72,17 @@ com.fasterxml.jackson.module jackson-module-parameter-names - 2.9.2 + 2.9.8 com.fasterxml.jackson.datatype jackson-datatype-jdk8 - 2.9.2 + 2.9.8 com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.9.2 + 2.9.8 From ec35f6c9c42b0a13104990102e7a80d83a635ca3 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Thu, 15 Aug 2019 12:09:47 -0500 Subject: [PATCH 2/4] Added CheckStyle (but not failing on error or violation) yet. --- libraries/bot-connector/pom.xml | 4 +++ libraries/bot-schema/pom.xml | 4 +++ pom.xml | 52 ++++++++++++++++++++++++++-- samples/bot-connector-sample/pom.xml | 33 ++++++++++++++++++ samples/servlet-echo/pom.xml | 35 +++++++++++++++++++ samples/spring-echo/pom.xml | 37 ++++++++++++++++++++ 6 files changed, 163 insertions(+), 2 deletions(-) diff --git a/libraries/bot-connector/pom.xml b/libraries/bot-connector/pom.xml index 301dfdc1f..00832d30e 100644 --- a/libraries/bot-connector/pom.xml +++ b/libraries/bot-connector/pom.xml @@ -134,6 +134,10 @@ org.apache.maven.plugins maven-pmd-plugin + + org.apache.maven.plugins + maven-checkstyle-plugin + org.eluder.coveralls diff --git a/libraries/bot-schema/pom.xml b/libraries/bot-schema/pom.xml index c728a4252..1720019d7 100644 --- a/libraries/bot-schema/pom.xml +++ b/libraries/bot-schema/pom.xml @@ -102,6 +102,10 @@ org.apache.maven.plugins maven-pmd-plugin + + org.apache.maven.plugins + maven-checkstyle-plugin + org.eluder.coveralls diff --git a/pom.xml b/pom.xml index c01b5950e..43ec2dfd9 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,8 @@ UTF-8 true 1.8 + 3.1.0 + 3.12.0 https://botbuilder.myget.org/F/scratch/maven/ @@ -161,7 +163,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.12.0 + ${pmd.version} true true @@ -176,6 +178,28 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle.version} + + + UTF-8 + false + false + false + false + + + + validate + validate + + check + + + + org.eluder.coveralls @@ -266,6 +290,18 @@ + + + org.apache.maven.plugins + maven-site-plugin + 3.7.1 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + @@ -275,7 +311,19 @@ org.apache.maven.plugins maven-pmd-plugin - 3.12.0 + ${pmd.version} + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle.version} + + + + checkstyle + + + diff --git a/samples/bot-connector-sample/pom.xml b/samples/bot-connector-sample/pom.xml index 48bc76770..531f9ed0a 100644 --- a/samples/bot-connector-sample/pom.xml +++ b/samples/bot-connector-sample/pom.xml @@ -137,7 +137,40 @@ + + org.apache.maven.plugins + maven-site-plugin + 3.7.1 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.12.0 + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + + + checkstyle + + + + + + + diff --git a/samples/servlet-echo/pom.xml b/samples/servlet-echo/pom.xml index 288689bd8..03889e664 100644 --- a/samples/servlet-echo/pom.xml +++ b/samples/servlet-echo/pom.xml @@ -173,6 +173,41 @@ + + + org.apache.maven.plugins + maven-site-plugin + 3.7.1 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.12.0 + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + + + checkstyle + + + + + + + diff --git a/samples/spring-echo/pom.xml b/samples/spring-echo/pom.xml index d916b955b..e8b6d1b3e 100644 --- a/samples/spring-echo/pom.xml +++ b/samples/spring-echo/pom.xml @@ -11,6 +11,7 @@ jar ${project.groupId}:${project.artifactId} + This package contains a Java Bot Echo sample using Spring Boot. http://maven.apache.org @@ -41,6 +42,7 @@ UTF-8 1.8 com.microsoft.bot.sample.spring.Application + https://botbuilder.myget.org/F/scratch/maven/ @@ -195,6 +197,41 @@ + + + org.apache.maven.plugins + maven-site-plugin + 3.7.1 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.12.0 + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + + + checkstyle + + + + + + + From 1ff8e11da229d8dcd3ef19f87adbfeb3dcb9d43f Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Thu, 15 Aug 2019 13:07:34 -0500 Subject: [PATCH 3/4] Corrected spring-echo README.md instructions due to jar name change. --- samples/spring-echo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/spring-echo/README.md b/samples/spring-echo/README.md index c46553f5c..d7f747d97 100644 --- a/samples/spring-echo/README.md +++ b/samples/spring-echo/README.md @@ -13,7 +13,7 @@ This sample is a Spring Boot app and uses the Azure CLI and azure-webapp Maven p ## To try this sample locally - From the root of this project folder: - Build the sample using `mvn package` - - Run it by using `java -jar .\target\springechobot-sample.jar` + - Run it by using `java -jar .\target\bot-spring-echo-sample.jar` - Test the bot using Bot Framework Emulator From 215e068da33683159cef96d6fac3d6c842ab6d8d Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Thu, 15 Aug 2019 16:04:18 -0500 Subject: [PATCH 4/4] Moved log4j dependency to spring-sample and using slf4j. --- samples/spring-echo/pom.xml | 21 +++++++++++++++++++ .../bot/sample/spring/BotController.java | 7 ++++++- .../src/main/resources/application.properties | 4 ++-- .../src/main/resources/log4j2.json | 18 ++++++++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 samples/spring-echo/src/main/resources/log4j2.json diff --git a/samples/spring-echo/pom.xml b/samples/spring-echo/pom.xml index e8b6d1b3e..a7e43d14e 100644 --- a/samples/spring-echo/pom.xml +++ b/samples/spring-echo/pom.xml @@ -86,6 +86,27 @@ jackson-datatype-jsr310 2.9.8 + + + org.slf4j + slf4j-api + + + org.apache.logging.log4j + log4j-api + 2.11.0 + + + org.apache.logging.log4j + log4j-core + 2.11.0 + + + org.slf4j + slf4j-log4j12 + 1.7.25 + test + diff --git a/samples/spring-echo/src/main/java/com/microsoft/bot/sample/spring/BotController.java b/samples/spring-echo/src/main/java/com/microsoft/bot/sample/spring/BotController.java index 848184f71..bbabda0de 100644 --- a/samples/spring-echo/src/main/java/com/microsoft/bot/sample/spring/BotController.java +++ b/samples/spring-echo/src/main/java/com/microsoft/bot/sample/spring/BotController.java @@ -2,7 +2,8 @@ // Licensed under the MIT License. package com.microsoft.bot.sample.spring; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -41,6 +42,8 @@ public class BotController { private CredentialProvider _credentialProvider; private MicrosoftAppCredentials _credentials; + private Logger logger = LoggerFactory.getLogger(BotController.class); + /** * Performs post construction initialization for this controller. * This must be done post construction so that application.properties @@ -66,6 +69,8 @@ public ResponseEntity incoming(@RequestBody Activity activity, CompletableFuture authenticateRequest = JwtTokenValidation.authenticateRequest(activity, authHeader, _credentialProvider); authenticateRequest.thenRunAsync(() -> { if (activity.type().equals(ActivityTypes.MESSAGE)) { + logger.info("Received: " + activity.text()); + // reply activity with the same text ConnectorClientImpl connector = new ConnectorClientImpl(activity.serviceUrl(), _credentials); connector.conversations().sendToConversation(activity.conversation().id(), diff --git a/samples/spring-echo/src/main/resources/application.properties b/samples/spring-echo/src/main/resources/application.properties index a695b3bf0..65a910fd3 100644 --- a/samples/spring-echo/src/main/resources/application.properties +++ b/samples/spring-echo/src/main/resources/application.properties @@ -1,2 +1,2 @@ -MicrosoftAppId= -MicrosoftAppPassword= +MicrosoftAppId=9c286e2f-e070-4af5-a3f1-350d666214ed +MicrosoftAppPassword=b0tframew0rk s3cr3t! diff --git a/samples/spring-echo/src/main/resources/log4j2.json b/samples/spring-echo/src/main/resources/log4j2.json new file mode 100644 index 000000000..67c0ad530 --- /dev/null +++ b/samples/spring-echo/src/main/resources/log4j2.json @@ -0,0 +1,18 @@ +{ + "configuration": { + "name": "Default", + "appenders": { + "Console": { + "name": "Console-Appender", + "target": "SYSTEM_OUT", + "PatternLayout": {"pattern": "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"} + } + }, + "loggers": { + "root": { + "level": "debug", + "appender-ref": {"ref": "Console-Appender","level": "debug"} + } + } + } +}