diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 297436e..9959e9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v3 with: - java-version: '20' + java-version: '21' distribution: 'temurin' cache: maven - name: Build with Maven diff --git a/.gitignore b/.gitignore index e425386..392df4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target/ +out/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ !**/src/test/**/target/ diff --git a/.idea/misc.xml b/.idea/misc.xml index 6dd779b..970f095 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -6,8 +7,9 @@ + - + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c6c2ba9..5fba2b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM maven:3.9-eclipse-temurin-20-alpine AS build +FROM maven:3.9-eclipse-temurin-21 AS build WORKDIR /opt/cp4m @@ -7,7 +7,7 @@ COPY src src RUN mvn clean -U package -Dcustom.jarName=cp4m -Dmaven.test.skip=true -FROM eclipse-temurin:20-jdk-alpine +FROM eclipse-temurin:21 WORKDIR /opt/cp4m COPY --from=build /opt/cp4m/target/cp4m.jar . diff --git a/assets/cp4m_logo.png b/assets/cp4m_logo.png new file mode 100644 index 0000000..4fdca21 Binary files /dev/null and b/assets/cp4m_logo.png differ diff --git a/docs/docs/tutorial-basics/markdown-features.mdx b/docs/docs/tutorial-basics/markdown-features.mdx index 0337f34..0afc485 100644 --- a/docs/docs/tutorial-basics/markdown-features.mdx +++ b/docs/docs/tutorial-basics/markdown-features.mdx @@ -43,19 +43,6 @@ Let's see how to [Create a page](./create-a-page.md). Regular Markdown images are supported. -You can use absolute paths to reference images in the static directory (`static/img/docusaurus.png`): - -```md -![Docusaurus logo](/img/docusaurus.png) -``` - -![Docusaurus logo](/img/docusaurus.png) - -You can reference images relative to the current file as well. This is particularly useful to colocate images close to the Markdown files using them: - -```md -![Docusaurus logo](./img/docusaurus.png) -``` ## Code Blocks diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index a683166..ff7d1c1 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -11,20 +11,20 @@ /** @type {import('@docusaurus/types').Config} */ const config = { - title: 'My Site', - tagline: 'The tagline of my site', - favicon: 'img/favicon.ico', + title: 'Conversational Platform for Marketing (CP4M)', + tagline: 'Integrate your LLM bot with Whatsapp, Messenger, and IG Direct in under an hour!', + favicon: 'CP4M/img/cp4m_logo.png', // Set the production url of your site here - url: 'https://your-docusaurus-test-site.com', + url: 'https://facebookincubator.github.io/', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: '/', + baseUrl: '/CP4M/', // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. - organizationName: 'facebook', // Usually your GitHub org/user name. - projectName: 'docusaurus', // Usually your repo name. + organizationName: 'facebookincubator', // Usually your GitHub org/user name. + projectName: 'CP4M', // Usually your repo name. onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', @@ -39,14 +39,14 @@ const config = { // Please change this to your repo. // Remove this to remove the "edit this page" links. editUrl: - 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', + 'https://facebookincubator.github.io/CP4M/docs/intro/', }, blog: { showReadingTime: true, // Please change this to your repo. // Remove this to remove the "edit this page" links. editUrl: - 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', + 'https://facebookincubator.github.io/CP4M/blog/', }, theme: { customCss: require.resolve('./src/css/custom.css'), @@ -58,24 +58,24 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ - image: 'img/docusaurus-social-card.jpg', + image: 'CP4M/img/cp4m_logo.png', navbar: { - title: 'My Meta Project', + title: 'CP4M', logo: { - alt: 'My Meta Project Logo', - src: 'img/logo.svg', + alt: 'CP4M Logo', + src: 'CP4M/img/cp4m_logo.png', }, items: [ { type: 'docSidebar', sidebarId: 'tutorialSidebar', position: 'left', - label: 'Tutorial', + label: 'Get Started', }, {to: 'blog', label: 'Blog', position: 'left'}, // Please keep GitHub link to the right for consistency. { - href: 'https://github.com/facebook/docusaurus', + href: 'https://github.com/facebookincubator/CP4M', label: 'GitHub', position: 'right', }, @@ -86,33 +86,6 @@ const config = { links: [ { title: 'Learn', - items: [ - { - label: 'Style Guide', - to: 'docs/', - }, - { - label: 'Second Doc', - to: 'docs/doc2', - }, - ], - }, - { - title: 'Community', - items: [ - { - label: 'Stack Overflow', - href: 'https://stackoverflow.com/questions/tagged/docusaurus', - }, - { - label: 'Twitter', - href: 'https://twitter.com/docusaurus', - }, - { - label: 'Discord', - href: 'https://discordapp.com/invite/docusaurus', - }, - ], }, { title: 'More', @@ -123,7 +96,7 @@ const config = { }, { label: 'GitHub', - href: 'https://github.com/facebook/docusaurus', + href: 'https://github.com/facebookincubator/CP4M', }, ], }, @@ -154,7 +127,7 @@ const config = { alt: 'Meta Open Source Logo', // This default includes a positive & negative version, allowing for // appropriate use depending on your site's style. - src: '/img/meta_opensource_logo_negative.svg', + src: 'CP4M/img/meta_opensource_logo_negative.svg', href: 'https://opensource.fb.com', }, // Please do not remove the credits, help to publicize Docusaurus :) diff --git a/docs/src/pages/index.js b/docs/src/pages/index.js index 6b378cd..73511d0 100644 --- a/docs/src/pages/index.js +++ b/docs/src/pages/index.js @@ -18,7 +18,7 @@ import styles from './styles.module.css'; const features = [ { title: 'Easy to Use', - imageUrl: 'img/undraw_docusaurus_mountain.svg', + imageUrl: 'CP4M/img/undraw_docusaurus_mountain.svg', description: ( <> Docusaurus was designed from the ground up to be easily installed and @@ -28,7 +28,7 @@ const features = [ }, { title: 'Focus on What Matters', - imageUrl: 'img/undraw_docusaurus_tree.svg', + imageUrl: 'CP4M/img/undraw_docusaurus_tree.svg', description: ( <> Docusaurus lets you focus on your docs, and we'll do the chores. Go @@ -38,7 +38,7 @@ const features = [ }, { title: 'Powered by React', - imageUrl: 'img/undraw_docusaurus_react.svg', + imageUrl: 'CP4M/img/undraw_docusaurus_react.svg', description: ( <> Extend or customize your website layout by reusing React. Docusaurus can @@ -68,7 +68,7 @@ export default function Home() { const {siteConfig = {}} = context; return (
@@ -80,7 +80,7 @@ export default function Home() { 'button button--outline button--secondary button--lg', styles.getStarted, )} - to={useBaseUrl('docs/')}> + to={useBaseUrl('docs/intro')}> Get Started
diff --git a/docs/static/CP4M/img/cp4m_logo.png b/docs/static/CP4M/img/cp4m_logo.png new file mode 100644 index 0000000..4fdca21 Binary files /dev/null and b/docs/static/CP4M/img/cp4m_logo.png differ diff --git a/docs/static/img/meta_opensource_logo.svg b/docs/static/CP4M/img/meta_opensource_logo.svg similarity index 100% rename from docs/static/img/meta_opensource_logo.svg rename to docs/static/CP4M/img/meta_opensource_logo.svg diff --git a/docs/static/img/meta_opensource_logo_negative.svg b/docs/static/CP4M/img/meta_opensource_logo_negative.svg similarity index 100% rename from docs/static/img/meta_opensource_logo_negative.svg rename to docs/static/CP4M/img/meta_opensource_logo_negative.svg diff --git a/docs/static/img/undraw_docusaurus_mountain.svg b/docs/static/CP4M/img/undraw_docusaurus_mountain.svg similarity index 100% rename from docs/static/img/undraw_docusaurus_mountain.svg rename to docs/static/CP4M/img/undraw_docusaurus_mountain.svg diff --git a/docs/static/img/undraw_docusaurus_react.svg b/docs/static/CP4M/img/undraw_docusaurus_react.svg similarity index 100% rename from docs/static/img/undraw_docusaurus_react.svg rename to docs/static/CP4M/img/undraw_docusaurus_react.svg diff --git a/docs/static/img/undraw_docusaurus_tree.svg b/docs/static/CP4M/img/undraw_docusaurus_tree.svg similarity index 100% rename from docs/static/img/undraw_docusaurus_tree.svg rename to docs/static/CP4M/img/undraw_docusaurus_tree.svg diff --git a/docs/static/img/docusaurus-social-card.jpg b/docs/static/img/docusaurus-social-card.jpg deleted file mode 100644 index ffcb448..0000000 Binary files a/docs/static/img/docusaurus-social-card.jpg and /dev/null differ diff --git a/docs/static/img/docusaurus.png b/docs/static/img/docusaurus.png deleted file mode 100644 index f458149..0000000 Binary files a/docs/static/img/docusaurus.png and /dev/null differ diff --git a/docs/static/img/favicon.ico b/docs/static/img/favicon.ico deleted file mode 100644 index c01d54b..0000000 Binary files a/docs/static/img/favicon.ico and /dev/null differ diff --git a/docs/static/img/logo.svg b/docs/static/img/logo.svg deleted file mode 100644 index 5d3da46..0000000 --- a/docs/static/img/logo.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index 771b743..419f844 100644 --- a/pom.xml +++ b/pom.xml @@ -17,8 +17,8 @@ 1.0-SNAPSHOT - 20 - 20 + 21 + 21 UTF-8 2.15.2 5.10.0 @@ -81,7 +81,7 @@ io.javalin javalin - 5.6.2 + 6.0.1 org.apache.httpcomponents.client5 @@ -132,6 +132,7 @@ shade + true diff --git a/src/main/java/com/meta/cp4m/ServicesRunner.java b/src/main/java/com/meta/cp4m/ServicesRunner.java index e70c5e4..dc9fce8 100644 --- a/src/main/java/com/meta/cp4m/ServicesRunner.java +++ b/src/main/java/com/meta/cp4m/ServicesRunner.java @@ -81,7 +81,7 @@ record RouteGroup(String path, HandlerType handlerType) {} } routeGroups.forEach( (routeGroup, routes) -> - app.addHandler( + app.addHttpHandler( routeGroup.handlerType(), routeGroup.path(), ctx -> this.routeSelectorAndHandler(ctx, routes))); @@ -125,6 +125,6 @@ public int port() { @Override public void close() { - app.close(); + app.stop(); } } diff --git a/src/test/java/com/meta/cp4m/DummyWebServer.java b/src/test/java/com/meta/cp4m/DummyWebServer.java index c0621cb..5388145 100644 --- a/src/test/java/com/meta/cp4m/DummyWebServer.java +++ b/src/test/java/com/meta/cp4m/DummyWebServer.java @@ -24,7 +24,7 @@ public class DummyWebServer implements AutoCloseable { private DummyWebServer() { this.javalin = Javalin.create() - .addHandler( + .addHttpHandler( HandlerType.GET, "/", ctx -> @@ -35,7 +35,7 @@ private DummyWebServer() { ctx.contentType(), ctx.headerMap(), ctx.queryParamMap()))) - .addHandler( + .addHttpHandler( HandlerType.POST, "/", ctx -> @@ -75,7 +75,7 @@ public Javalin javalin() { @Override public void close() { - javalin.close(); + javalin.stop(); } public record ReceivedRequest( diff --git a/src/test/java/com/meta/cp4m/message/ConfigParamTestSpec.java b/src/test/java/com/meta/cp4m/message/ConfigParamTestSpec.java index f76c3cf..b2690cd 100644 --- a/src/test/java/com/meta/cp4m/message/ConfigParamTestSpec.java +++ b/src/test/java/com/meta/cp4m/message/ConfigParamTestSpec.java @@ -72,7 +72,8 @@ public boolean required() { return required; } - public @NewInstance ConfigParamTestSpec validValues(H... validValues) { + @SafeVarargs + public final @NewInstance ConfigParamTestSpec validValues(final H... validValues) { Collection newValidValues = new ArrayList<>(this.invalidValues); Arrays.stream(validValues).map(ConfigParamTestSpec::toJsonNode).forEach(newValidValues::add); return new ConfigParamTestSpec<>( @@ -83,7 +84,8 @@ public Collection validValues() { return validValues; } - public @NewInstance ConfigParamTestSpec invalidValues(H... invalidValues) { + @SafeVarargs + public final @NewInstance ConfigParamTestSpec invalidValues(final H... invalidValues) { Collection newInvalidValues = new ArrayList<>(this.invalidValues); Arrays.stream(invalidValues) .map(ConfigParamTestSpec::toJsonNode) diff --git a/src/test/java/com/meta/cp4m/message/FBMessageHandlerTest.java b/src/test/java/com/meta/cp4m/message/FBMessageHandlerTest.java index aceb427..6933d5a 100644 --- a/src/test/java/com/meta/cp4m/message/FBMessageHandlerTest.java +++ b/src/test/java/com/meta/cp4m/message/FBMessageHandlerTest.java @@ -257,14 +257,14 @@ static Stream requestFactory() throws JsonProcessingException { void setUp() { app = Javalin.create(); - app.addHandler( + app.addHttpHandler( HandlerType.GET, "*", ctx -> fail("the pipeline should only be sending post requests")); - app.addHandler( + app.addHttpHandler( HandlerType.DELETE, "*", ctx -> fail("the pipeline should only be sending post requests")); - app.addHandler( + app.addHttpHandler( HandlerType.PUT, "*", ctx -> fail("the pipeline should only be sending post requests")); requests = new LinkedBlockingQueue<>(); - app.addHandler( + app.addHttpHandler( HandlerType.POST, "/", ctx -> requests.add(new OutboundRequest(ctx.body(), ctx.headerMap(), ctx.queryParamMap()))); @@ -272,7 +272,7 @@ void setUp() { @AfterEach void tearDown() { - app.close(); + app.stop(); } @Test