Skip to content

Commit

Permalink
Merge branch 'main' into hunter/loopback_not_localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterjackson authored Mar 26, 2024
2 parents 2c99751 + a2ab57f commit 5cb52fb
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target/
out/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
Expand Down
4 changes: 3 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 .

Expand Down
Binary file added assets/cp4m_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions docs/docs/tutorial-basics/markdown-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
61 changes: 17 additions & 44 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
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',
Expand All @@ -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'),
Expand All @@ -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',
},
Expand All @@ -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',
Expand All @@ -123,7 +96,7 @@ const config = {
},
{
label: 'GitHub',
href: 'https://github.com/facebook/docusaurus',
href: 'https://github.com/facebookincubator/CP4M',
},
],
},
Expand Down Expand Up @@ -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 :)
Expand Down
10 changes: 5 additions & 5 deletions docs/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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&apos;ll do the chores. Go
Expand All @@ -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
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function Home() {
const {siteConfig = {}} = context;
return (
<Layout
title={`Hello from ${siteConfig.title}`}
title={`CP4M`}
description="Description will go into a meta tag in <head />">
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
Expand All @@ -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
</Link>
</div>
Expand Down
Binary file added docs/static/CP4M/img/cp4m_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file removed docs/static/img/docusaurus-social-card.jpg
Binary file not shown.
Binary file removed docs/static/img/docusaurus.png
Binary file not shown.
Binary file removed docs/static/img/favicon.ico
Binary file not shown.
36 changes: 0 additions & 36 deletions docs/static/img/logo.svg

This file was deleted.

7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacksonVersion>2.15.2</jacksonVersion>
<junit5Version>5.10.0</junit5Version>
Expand Down Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>io.javalin</groupId>
<artifactId>javalin</artifactId>
<version>5.6.2</version>
<version>6.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
Expand Down Expand Up @@ -132,6 +132,7 @@
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/meta/cp4m/ServicesRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down Expand Up @@ -125,6 +125,6 @@ public int port() {

@Override
public void close() {
app.close();
app.stop();
}
}
6 changes: 3 additions & 3 deletions src/test/java/com/meta/cp4m/DummyWebServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class DummyWebServer implements AutoCloseable {
private DummyWebServer() {
this.javalin =
Javalin.create()
.addHandler(
.addHttpHandler(
HandlerType.GET,
"/<path>",
ctx ->
Expand All @@ -35,7 +35,7 @@ private DummyWebServer() {
ctx.contentType(),
ctx.headerMap(),
ctx.queryParamMap())))
.addHandler(
.addHttpHandler(
HandlerType.POST,
"/<path>",
ctx ->
Expand Down Expand Up @@ -75,7 +75,7 @@ public Javalin javalin() {

@Override
public void close() {
javalin.close();
javalin.stop();
}

public record ReceivedRequest(
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/com/meta/cp4m/message/ConfigParamTestSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public boolean required() {
return required;
}

public @NewInstance <H> ConfigParamTestSpec<T> validValues(H... validValues) {
@SafeVarargs
public final @NewInstance <H> ConfigParamTestSpec<T> validValues(final H... validValues) {
Collection<JsonNode> newValidValues = new ArrayList<>(this.invalidValues);
Arrays.stream(validValues).map(ConfigParamTestSpec::toJsonNode).forEach(newValidValues::add);
return new ConfigParamTestSpec<>(
Expand All @@ -83,7 +84,8 @@ public Collection<JsonNode> validValues() {
return validValues;
}

public @NewInstance <H> ConfigParamTestSpec<T> invalidValues(H... invalidValues) {
@SafeVarargs
public final @NewInstance <H> ConfigParamTestSpec<T> invalidValues(final H... invalidValues) {
Collection<JsonNode> newInvalidValues = new ArrayList<>(this.invalidValues);
Arrays.stream(invalidValues)
.map(ConfigParamTestSpec::toJsonNode)
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/com/meta/cp4m/message/FBMessageHandlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,22 +257,22 @@ static Stream<Arguments> 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())));
}

@AfterEach
void tearDown() {
app.close();
app.stop();
}

@Test
Expand Down

0 comments on commit 5cb52fb

Please sign in to comment.