diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 31d57ef..33c8470 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,7 +14,7 @@ env: JAVA_VERSION: 21 jobs: - deploy: + deploy-web: runs-on: [ ubuntu-latest ] steps: - name: Checkout code @@ -37,7 +37,7 @@ jobs: username: _ - name: Push image to Heroku registry - run: ./gradlew dockerPushHerokuProduction + run: ./gradlew :chucknorris-web:dockerPushHerokuProduction - name: Trigger release shell: bash diff --git a/build.gradle b/build.gradle index c46114e..a754ba0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,98 +1,45 @@ -plugins { - id 'com.diffplug.spotless' version '7.0.0.BETA1' - id 'com.palantir.docker' version '0.36.0' - id 'io.spring.dependency-management' version '1.1.5' - id 'java' - id 'org.springframework.boot' version '2.7.18' +import org.gradle.api.tasks.testing.logging.TestLogEvent + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath("com.diffplug.spotless:spotless-plugin-gradle:${Version.SPOTLESS}") + classpath("org.springframework.boot:spring-boot-gradle-plugin:${Version.SPRING_BOOT}") + } } -def gitRev = { -> - def stdout = new ByteArrayOutputStream() +version = Git.commitHash() - exec { - commandLine 'git', 'rev-parse', 'HEAD' - standardOutput = stdout - } +subprojects { Project project -> + apply plugin: 'com.diffplug.spotless' + apply plugin: 'io.spring.dependency-management' + apply plugin: 'java' - return stdout.toString().trim() -} - -String appName = "api" -String appVer = gitRev() - -group = "io.chucknorris" -version = appVer -java.sourceCompatibility = JavaVersion.VERSION_17 - -repositories { - mavenCentral() -} - -// versions -def lombokVersion = "1.18.30" + sourceCompatibility = 17 + targetCompatibility = 17 + version Git.commitHash() -dependencies { - annotationProcessor "org.projectlombok:lombok:${lombokVersion}" + dependencyManagement { + imports { mavenBom("org.springframework.boot:spring-boot-dependencies:${Version.SPRING_BOOT}") } + } - implementation "com.amazonaws:aws-java-sdk:1.11.561" - implementation "com.fasterxml.jackson.core:jackson-core:2.17.1" - implementation "com.rometools:rome:1.12.0" - implementation "com.vladmihalcea:hibernate-types-52:2.4.0" - implementation "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.3.0" - implementation "org.hibernate:hibernate-validator:6.0.16.Final" - implementation "org.postgresql:postgresql:42.2.9" - implementation "org.projectlombok:lombok:${lombokVersion}" - implementation "org.springframework.boot:spring-boot-starter-data-jpa" - implementation "org.springframework.boot:spring-boot-starter-thymeleaf" - implementation "org.springframework.boot:spring-boot-starter-web" - implementation 'com.google.guava:guava:33.2.1-jre' - - testImplementation "org.springframework.boot:spring-boot-starter-test" - testImplementation 'junit:junit:4.12' -} + repositories { + mavenCentral() + } -tasks { - bootJar { - manifest.attributes( - 'Multi-Release': 'true' - ) + tasks.withType(Test) { + useJUnitPlatform() - archiveBaseName.set(appName) - archiveVersion.set(appVer) + testLogging { + events TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED + } + } - if (project.hasProperty("archiveName")) { - archiveFileName.set(project.properties["archiveName"] as String) - } - } - - docker { - dependsOn bootJar - - def imageName = "${project.properties.group}/${appName}" - name = "${imageName}:latest" - - tag("current", "${imageName}:${appVer}") - tag("latest", "${imageName}:latest") - tag("herokuProduction", "registry.heroku.com/chucky/web") - - dockerfile file("${projectDir}/src/main/docker/Dockerfile") - files tasks.bootJar.outputs - buildArgs([JAR_FILE: bootJar.getArchiveFileName().get()]) - } - - springBoot { - buildInfo { - properties { - artifact = "${appName}-${appVer}.jar" - version = appVer - name = appName - } - } - } - - spotless { - java { - googleJavaFormat() - } - } -} + spotless { + java { + googleJavaFormat() + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/Git.groovy b/buildSrc/src/main/groovy/Git.groovy new file mode 100644 index 0000000..383e158 --- /dev/null +++ b/buildSrc/src/main/groovy/Git.groovy @@ -0,0 +1,70 @@ +import org.gradle.api.GradleException + +class Git { + + private static final VERSION_2 = "git version 2" + + static String branch() throws GradleException { + def gitBranch = execute('git rev-parse --abbrev-ref HEAD') + + if (gitBranch == null || gitBranch.empty) { + throw new GradleException('Could not determine Git branch name') + } + + return gitBranch.replace("/", "-") + } + + static int commitCount() { + return execute('git rev-list --count HEAD').toInteger() + } + + static int commitDateUnix() { + return execute( + "git show -s --format=%ct ${commitHash()}" + ).toInteger() + } + + static String commitHash() { + return execute('git rev-parse HEAD') + } + + static String commitHashShort() { + return execute('git rev-parse --short HEAD').substring(0, 7) + } + + static String remoteOriginUrl() { + return execute('git config --get remote.origin.url') + } + + static void writePropertiesTo(pathname) { + def properties = new Properties() + + properties.setProperty('git.branch', branch()) + properties.setProperty('git.commit_count', commitCount().toString()) + properties.setProperty('git.commit_date_unix', commitDateUnix().toString()) + properties.setProperty('git.commit_long', commitHash()) + properties.setProperty('git.commit_short', commitHashShort()) + properties.setProperty('git.remote_origin_url', remoteOriginUrl()) + + def file = new File(pathname) + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs() + } + + file.withWriter('UTF-8') { + properties.each { key, value -> it.writeLine("$key = $value") } + } + } + + static boolean isAvailable() { + try { + return execute("git --version").startsWith(VERSION_2) + } catch (ignored) { + return false + } + } + + private static String execute(String command) { + return command.execute().in.text.trim() + } +} diff --git a/buildSrc/src/main/groovy/Version.groovy b/buildSrc/src/main/groovy/Version.groovy new file mode 100644 index 0000000..80168f9 --- /dev/null +++ b/buildSrc/src/main/groovy/Version.groovy @@ -0,0 +1,4 @@ +interface Version { + public static final String SPRING_BOOT = '2.7.18' + public static final String SPOTLESS = '7.0.0.BETA1' +} \ No newline at end of file diff --git a/chucknorris-web/build.gradle b/chucknorris-web/build.gradle new file mode 100644 index 0000000..c847cc2 --- /dev/null +++ b/chucknorris-web/build.gradle @@ -0,0 +1,69 @@ +plugins { + id "com.palantir.docker" version "0.36.0" + id 'org.springframework.boot' +} + +repositories { + mavenCentral() +} + +// versions +def lombokVersion = "1.18.30" + +dependencies { + annotationProcessor "org.projectlombok:lombok:${lombokVersion}" + + implementation "com.amazonaws:aws-java-sdk:1.11.561" + implementation "com.fasterxml.jackson.core:jackson-core:2.17.1" + implementation "com.rometools:rome:1.12.0" + implementation "com.vladmihalcea:hibernate-types-52:2.4.0" + implementation "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.3.0" + implementation "org.hibernate:hibernate-validator:6.0.16.Final" + implementation "org.postgresql:postgresql:42.2.9" + implementation "org.projectlombok:lombok:${lombokVersion}" + implementation "org.springframework.boot:spring-boot-starter-data-jpa" + implementation "org.springframework.boot:spring-boot-starter-thymeleaf" + implementation "org.springframework.boot:spring-boot-starter-web" + implementation "com.google.guava:guava:33.2.1-jre" + + testImplementation "org.springframework.boot:spring-boot-starter-test" + testImplementation "junit:junit:4.12" +} + +tasks { + bootJar { + manifest.attributes("Multi-Release": "true") + + archiveBaseName.set(project.name) + archiveVersion.set(project.version) + + if (project.hasProperty("archiveName")) { + archiveFileName.set(project.properties["archiveName"] as String) + } + } + + docker { + dependsOn bootJar + + def imageName = "${project.properties.group}/${project.name}" + name = "${imageName}:latest" + + tag("current", "${imageName}:${project.version}") + tag("latest", "${imageName}:latest") + tag("herokuProduction", "registry.heroku.com/chucky/web") + + dockerfile file("${projectDir}/src/main/docker/Dockerfile") + files tasks.bootJar.outputs + buildArgs([JAR_FILE: bootJar.getArchiveFileName().get()]) + } + + springBoot { + buildInfo { + properties { + artifact = "${project.name}-${project.version}.jar" + version = project.version + name = project.name + } + } + } +} diff --git a/src/main/docker/Dockerfile b/chucknorris-web/src/main/docker/Dockerfile similarity index 100% rename from src/main/docker/Dockerfile rename to chucknorris-web/src/main/docker/Dockerfile diff --git a/src/main/java/io/chucknorris/api/Application.java b/chucknorris-web/src/main/java/io/chucknorris/api/Application.java similarity index 100% rename from src/main/java/io/chucknorris/api/Application.java rename to chucknorris-web/src/main/java/io/chucknorris/api/Application.java diff --git a/src/main/java/io/chucknorris/api/ApplicationExceptionHandler.java b/chucknorris-web/src/main/java/io/chucknorris/api/ApplicationExceptionHandler.java similarity index 100% rename from src/main/java/io/chucknorris/api/ApplicationExceptionHandler.java rename to chucknorris-web/src/main/java/io/chucknorris/api/ApplicationExceptionHandler.java diff --git a/src/main/java/io/chucknorris/api/configuration/AmazonWebServicesConfig.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/AmazonWebServicesConfig.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/AmazonWebServicesConfig.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/AmazonWebServicesConfig.java diff --git a/src/main/java/io/chucknorris/api/configuration/CrossOriginResourceSharingConfig.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/CrossOriginResourceSharingConfig.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/CrossOriginResourceSharingConfig.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/CrossOriginResourceSharingConfig.java diff --git a/src/main/java/io/chucknorris/api/configuration/DataSourceConfiguration.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/DataSourceConfiguration.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/DataSourceConfiguration.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/DataSourceConfiguration.java diff --git a/src/main/java/io/chucknorris/api/configuration/DataSourceProperties.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/DataSourceProperties.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/DataSourceProperties.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/DataSourceProperties.java diff --git a/src/main/java/io/chucknorris/api/configuration/DefaultDataSourceProperties.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/DefaultDataSourceProperties.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/DefaultDataSourceProperties.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/DefaultDataSourceProperties.java diff --git a/src/main/java/io/chucknorris/api/configuration/HerokuDataSourceProperties.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/HerokuDataSourceProperties.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/HerokuDataSourceProperties.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/HerokuDataSourceProperties.java diff --git a/src/main/java/io/chucknorris/api/configuration/LayoutConfig.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/LayoutConfig.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/LayoutConfig.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/LayoutConfig.java diff --git a/src/main/java/io/chucknorris/api/configuration/MailchimpConfig.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/MailchimpConfig.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/MailchimpConfig.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/MailchimpConfig.java diff --git a/src/main/java/io/chucknorris/api/configuration/ResolverConfig.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/ResolverConfig.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/ResolverConfig.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/ResolverConfig.java diff --git a/src/main/java/io/chucknorris/api/configuration/RestTemplateConfig.java b/chucknorris-web/src/main/java/io/chucknorris/api/configuration/RestTemplateConfig.java similarity index 100% rename from src/main/java/io/chucknorris/api/configuration/RestTemplateConfig.java rename to chucknorris-web/src/main/java/io/chucknorris/api/configuration/RestTemplateConfig.java diff --git a/src/main/java/io/chucknorris/api/feed/FeedController.java b/chucknorris-web/src/main/java/io/chucknorris/api/feed/FeedController.java similarity index 100% rename from src/main/java/io/chucknorris/api/feed/FeedController.java rename to chucknorris-web/src/main/java/io/chucknorris/api/feed/FeedController.java diff --git a/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuck.java b/chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuck.java similarity index 100% rename from src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuck.java rename to chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuck.java diff --git a/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckIssue.java b/chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckIssue.java similarity index 100% rename from src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckIssue.java rename to chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckIssue.java diff --git a/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckPublishedEvent.java b/chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckPublishedEvent.java similarity index 100% rename from src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckPublishedEvent.java rename to chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckPublishedEvent.java diff --git a/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckRss.java b/chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckRss.java similarity index 100% rename from src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckRss.java rename to chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckRss.java diff --git a/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckService.java b/chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckService.java similarity index 100% rename from src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckService.java rename to chucknorris-web/src/main/java/io/chucknorris/api/feed/dailychuck/DailyChuckService.java diff --git a/src/main/java/io/chucknorris/api/home/HomeController.java b/chucknorris-web/src/main/java/io/chucknorris/api/home/HomeController.java similarity index 100% rename from src/main/java/io/chucknorris/api/home/HomeController.java rename to chucknorris-web/src/main/java/io/chucknorris/api/home/HomeController.java diff --git a/src/main/java/io/chucknorris/api/joke/Joke.java b/chucknorris-web/src/main/java/io/chucknorris/api/joke/Joke.java similarity index 100% rename from src/main/java/io/chucknorris/api/joke/Joke.java rename to chucknorris-web/src/main/java/io/chucknorris/api/joke/Joke.java diff --git a/src/main/java/io/chucknorris/api/joke/JokeController.java b/chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeController.java similarity index 100% rename from src/main/java/io/chucknorris/api/joke/JokeController.java rename to chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeController.java diff --git a/src/main/java/io/chucknorris/api/joke/JokeRepository.java b/chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeRepository.java similarity index 100% rename from src/main/java/io/chucknorris/api/joke/JokeRepository.java rename to chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeRepository.java diff --git a/src/main/java/io/chucknorris/api/joke/JokeSearchResult.java b/chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeSearchResult.java similarity index 100% rename from src/main/java/io/chucknorris/api/joke/JokeSearchResult.java rename to chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeSearchResult.java diff --git a/src/main/java/io/chucknorris/api/joke/JokeSerializer.java b/chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeSerializer.java similarity index 100% rename from src/main/java/io/chucknorris/api/joke/JokeSerializer.java rename to chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeSerializer.java diff --git a/src/main/java/io/chucknorris/api/joke/JokeService.java b/chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeService.java similarity index 100% rename from src/main/java/io/chucknorris/api/joke/JokeService.java rename to chucknorris-web/src/main/java/io/chucknorris/api/joke/JokeService.java diff --git a/src/main/java/io/chucknorris/api/postcard/PostcardController.java b/chucknorris-web/src/main/java/io/chucknorris/api/postcard/PostcardController.java similarity index 100% rename from src/main/java/io/chucknorris/api/postcard/PostcardController.java rename to chucknorris-web/src/main/java/io/chucknorris/api/postcard/PostcardController.java diff --git a/src/main/java/io/chucknorris/api/privacy/PrivacyController.java b/chucknorris-web/src/main/java/io/chucknorris/api/privacy/PrivacyController.java similarity index 100% rename from src/main/java/io/chucknorris/api/privacy/PrivacyController.java rename to chucknorris-web/src/main/java/io/chucknorris/api/privacy/PrivacyController.java diff --git a/src/main/java/io/chucknorris/api/slack/AccessToken.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/AccessToken.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/AccessToken.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/AccessToken.java diff --git a/src/main/java/io/chucknorris/api/slack/CommandResponse.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/CommandResponse.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/CommandResponse.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/CommandResponse.java diff --git a/src/main/java/io/chucknorris/api/slack/CommandResponseAttachment.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/CommandResponseAttachment.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/CommandResponseAttachment.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/CommandResponseAttachment.java diff --git a/src/main/java/io/chucknorris/api/slack/Help.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/Help.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/Help.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/Help.java diff --git a/src/main/java/io/chucknorris/api/slack/Request.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/Request.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/Request.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/Request.java diff --git a/src/main/java/io/chucknorris/api/slack/RequestArgumentResolver.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/RequestArgumentResolver.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/RequestArgumentResolver.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/RequestArgumentResolver.java diff --git a/src/main/java/io/chucknorris/api/slack/ResponseType.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/ResponseType.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/ResponseType.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/ResponseType.java diff --git a/src/main/java/io/chucknorris/api/slack/SlackCommandResponse.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackCommandResponse.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/SlackCommandResponse.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackCommandResponse.java diff --git a/src/main/java/io/chucknorris/api/slack/SlackCommandResponseAttachment.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackCommandResponseAttachment.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/SlackCommandResponseAttachment.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackCommandResponseAttachment.java diff --git a/src/main/java/io/chucknorris/api/slack/SlackConnectEvent.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackConnectEvent.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/SlackConnectEvent.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackConnectEvent.java diff --git a/src/main/java/io/chucknorris/api/slack/SlackController.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackController.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/SlackController.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackController.java diff --git a/src/main/java/io/chucknorris/api/slack/SlackService.java b/chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackService.java similarity index 100% rename from src/main/java/io/chucknorris/api/slack/SlackService.java rename to chucknorris-web/src/main/java/io/chucknorris/api/slack/SlackService.java diff --git a/src/main/java/io/chucknorris/lib/DateUtil.java b/chucknorris-web/src/main/java/io/chucknorris/lib/DateUtil.java similarity index 100% rename from src/main/java/io/chucknorris/lib/DateUtil.java rename to chucknorris-web/src/main/java/io/chucknorris/lib/DateUtil.java diff --git a/src/main/java/io/chucknorris/lib/event/BaseEvent.java b/chucknorris-web/src/main/java/io/chucknorris/lib/event/BaseEvent.java similarity index 100% rename from src/main/java/io/chucknorris/lib/event/BaseEvent.java rename to chucknorris-web/src/main/java/io/chucknorris/lib/event/BaseEvent.java diff --git a/src/main/java/io/chucknorris/lib/event/Event.java b/chucknorris-web/src/main/java/io/chucknorris/lib/event/Event.java similarity index 100% rename from src/main/java/io/chucknorris/lib/event/Event.java rename to chucknorris-web/src/main/java/io/chucknorris/lib/event/Event.java diff --git a/src/main/java/io/chucknorris/lib/event/EventService.java b/chucknorris-web/src/main/java/io/chucknorris/lib/event/EventService.java similarity index 100% rename from src/main/java/io/chucknorris/lib/event/EventService.java rename to chucknorris-web/src/main/java/io/chucknorris/lib/event/EventService.java diff --git a/src/main/java/io/chucknorris/lib/exception/EntityNotFoundException.java b/chucknorris-web/src/main/java/io/chucknorris/lib/exception/EntityNotFoundException.java similarity index 100% rename from src/main/java/io/chucknorris/lib/exception/EntityNotFoundException.java rename to chucknorris-web/src/main/java/io/chucknorris/lib/exception/EntityNotFoundException.java diff --git a/src/main/java/io/chucknorris/lib/mailchimp/MailchimpService.java b/chucknorris-web/src/main/java/io/chucknorris/lib/mailchimp/MailchimpService.java similarity index 100% rename from src/main/java/io/chucknorris/lib/mailchimp/MailchimpService.java rename to chucknorris-web/src/main/java/io/chucknorris/lib/mailchimp/MailchimpService.java diff --git a/src/main/java/io/chucknorris/lib/mailchimp/MailingList.java b/chucknorris-web/src/main/java/io/chucknorris/lib/mailchimp/MailingList.java similarity index 100% rename from src/main/java/io/chucknorris/lib/mailchimp/MailingList.java rename to chucknorris-web/src/main/java/io/chucknorris/lib/mailchimp/MailingList.java diff --git a/src/main/java/io/chucknorris/lib/mailchimp/MailingListStatistic.java b/chucknorris-web/src/main/java/io/chucknorris/lib/mailchimp/MailingListStatistic.java similarity index 100% rename from src/main/java/io/chucknorris/lib/mailchimp/MailingListStatistic.java rename to chucknorris-web/src/main/java/io/chucknorris/lib/mailchimp/MailingListStatistic.java diff --git a/src/main/resources/application-example.properties b/chucknorris-web/src/main/resources/application-example.properties similarity index 100% rename from src/main/resources/application-example.properties rename to chucknorris-web/src/main/resources/application-example.properties diff --git a/src/main/resources/application.properties b/chucknorris-web/src/main/resources/application.properties similarity index 100% rename from src/main/resources/application.properties rename to chucknorris-web/src/main/resources/application.properties diff --git a/src/main/resources/static/css/styles.css b/chucknorris-web/src/main/resources/static/css/styles.css similarity index 100% rename from src/main/resources/static/css/styles.css rename to chucknorris-web/src/main/resources/static/css/styles.css diff --git a/src/main/resources/static/font/04b_30.ttf b/chucknorris-web/src/main/resources/static/font/04b_30.ttf similarity index 100% rename from src/main/resources/static/font/04b_30.ttf rename to chucknorris-web/src/main/resources/static/font/04b_30.ttf diff --git a/src/main/resources/static/font/04b_30.woff b/chucknorris-web/src/main/resources/static/font/04b_30.woff similarity index 100% rename from src/main/resources/static/font/04b_30.woff rename to chucknorris-web/src/main/resources/static/font/04b_30.woff diff --git a/src/main/resources/static/font/04b_30.woff2 b/chucknorris-web/src/main/resources/static/font/04b_30.woff2 similarity index 100% rename from src/main/resources/static/font/04b_30.woff2 rename to chucknorris-web/src/main/resources/static/font/04b_30.woff2 diff --git a/src/main/resources/static/img/add-to-slack-btn.png b/chucknorris-web/src/main/resources/static/img/add-to-slack-btn.png similarity index 100% rename from src/main/resources/static/img/add-to-slack-btn.png rename to chucknorris-web/src/main/resources/static/img/add-to-slack-btn.png diff --git a/src/main/resources/static/img/avatar/chuck-norris-alt-01-large.png b/chucknorris-web/src/main/resources/static/img/avatar/chuck-norris-alt-01-large.png similarity index 100% rename from src/main/resources/static/img/avatar/chuck-norris-alt-01-large.png rename to chucknorris-web/src/main/resources/static/img/avatar/chuck-norris-alt-01-large.png diff --git a/src/main/resources/static/img/avatar/chuck-norris-alt-01.png b/chucknorris-web/src/main/resources/static/img/avatar/chuck-norris-alt-01.png similarity index 100% rename from src/main/resources/static/img/avatar/chuck-norris-alt-01.png rename to chucknorris-web/src/main/resources/static/img/avatar/chuck-norris-alt-01.png diff --git a/src/main/resources/static/img/avatar/chuck-norris-alt-02.png b/chucknorris-web/src/main/resources/static/img/avatar/chuck-norris-alt-02.png similarity index 100% rename from src/main/resources/static/img/avatar/chuck-norris-alt-02.png rename to chucknorris-web/src/main/resources/static/img/avatar/chuck-norris-alt-02.png diff --git a/src/main/resources/static/img/avatar/chuck-norris.png b/chucknorris-web/src/main/resources/static/img/avatar/chuck-norris.png similarity index 100% rename from src/main/resources/static/img/avatar/chuck-norris.png rename to chucknorris-web/src/main/resources/static/img/avatar/chuck-norris.png diff --git a/src/main/resources/static/img/chuck-norris-dancing.gif b/chucknorris-web/src/main/resources/static/img/chuck-norris-dancing.gif similarity index 100% rename from src/main/resources/static/img/chuck-norris-dancing.gif rename to chucknorris-web/src/main/resources/static/img/chuck-norris-dancing.gif diff --git a/src/main/resources/static/img/chuck-norris-icon.jpg b/chucknorris-web/src/main/resources/static/img/chuck-norris-icon.jpg similarity index 100% rename from src/main/resources/static/img/chuck-norris-icon.jpg rename to chucknorris-web/src/main/resources/static/img/chuck-norris-icon.jpg diff --git a/src/main/resources/static/img/chuck-norris-logo.png b/chucknorris-web/src/main/resources/static/img/chuck-norris-logo.png similarity index 100% rename from src/main/resources/static/img/chuck-norris-logo.png rename to chucknorris-web/src/main/resources/static/img/chuck-norris-logo.png diff --git a/src/main/resources/static/img/chuck-norris-logo@2x.png b/chucknorris-web/src/main/resources/static/img/chuck-norris-logo@2x.png similarity index 100% rename from src/main/resources/static/img/chuck-norris-logo@2x.png rename to chucknorris-web/src/main/resources/static/img/chuck-norris-logo@2x.png diff --git a/src/main/resources/static/img/chuck-norris-slack-screenshot.png b/chucknorris-web/src/main/resources/static/img/chuck-norris-slack-screenshot.png similarity index 100% rename from src/main/resources/static/img/chuck-norris-slack-screenshot.png rename to chucknorris-web/src/main/resources/static/img/chuck-norris-slack-screenshot.png diff --git a/src/main/resources/static/img/chucknorris_icon.png b/chucknorris-web/src/main/resources/static/img/chucknorris_icon.png similarity index 100% rename from src/main/resources/static/img/chucknorris_icon.png rename to chucknorris-web/src/main/resources/static/img/chucknorris_icon.png diff --git a/src/main/resources/static/img/chucknorris_logo_bw.png b/chucknorris-web/src/main/resources/static/img/chucknorris_logo_bw.png similarity index 100% rename from src/main/resources/static/img/chucknorris_logo_bw.png rename to chucknorris-web/src/main/resources/static/img/chucknorris_logo_bw.png diff --git a/src/main/resources/static/img/chucknorris_logo_coloured.png b/chucknorris-web/src/main/resources/static/img/chucknorris_logo_coloured.png similarity index 100% rename from src/main/resources/static/img/chucknorris_logo_coloured.png rename to chucknorris-web/src/main/resources/static/img/chucknorris_logo_coloured.png diff --git a/src/main/resources/static/img/chucknorris_logo_coloured_small.png b/chucknorris-web/src/main/resources/static/img/chucknorris_logo_coloured_small.png similarity index 100% rename from src/main/resources/static/img/chucknorris_logo_coloured_small.png rename to chucknorris-web/src/main/resources/static/img/chucknorris_logo_coloured_small.png diff --git a/src/main/resources/static/img/chucknorris_logo_coloured_small@2x.png b/chucknorris-web/src/main/resources/static/img/chucknorris_logo_coloured_small@2x.png similarity index 100% rename from src/main/resources/static/img/chucknorris_logo_coloured_small@2x.png rename to chucknorris-web/src/main/resources/static/img/chucknorris_logo_coloured_small@2x.png diff --git a/src/main/resources/static/img/favicon.ico b/chucknorris-web/src/main/resources/static/img/favicon.ico similarity index 100% rename from src/main/resources/static/img/favicon.ico rename to chucknorris-web/src/main/resources/static/img/favicon.ico diff --git a/src/main/resources/static/robots.txt b/chucknorris-web/src/main/resources/static/robots.txt similarity index 100% rename from src/main/resources/static/robots.txt rename to chucknorris-web/src/main/resources/static/robots.txt diff --git a/src/main/resources/templates/connect/slack.html b/chucknorris-web/src/main/resources/templates/connect/slack.html similarity index 100% rename from src/main/resources/templates/connect/slack.html rename to chucknorris-web/src/main/resources/templates/connect/slack.html diff --git a/src/main/resources/templates/home.html b/chucknorris-web/src/main/resources/templates/home.html similarity index 100% rename from src/main/resources/templates/home.html rename to chucknorris-web/src/main/resources/templates/home.html diff --git a/src/main/resources/templates/joke.html b/chucknorris-web/src/main/resources/templates/joke.html similarity index 100% rename from src/main/resources/templates/joke.html rename to chucknorris-web/src/main/resources/templates/joke.html diff --git a/src/main/resources/templates/layouts/default.html b/chucknorris-web/src/main/resources/templates/layouts/default.html similarity index 100% rename from src/main/resources/templates/layouts/default.html rename to chucknorris-web/src/main/resources/templates/layouts/default.html diff --git a/src/main/resources/templates/privacy.html b/chucknorris-web/src/main/resources/templates/privacy.html similarity index 100% rename from src/main/resources/templates/privacy.html rename to chucknorris-web/src/main/resources/templates/privacy.html diff --git a/src/test/java/io/chucknorris/api/configuration/HerokuDataSourcePropertiesTest.java b/chucknorris-web/src/test/java/io/chucknorris/api/configuration/HerokuDataSourcePropertiesTest.java similarity index 100% rename from src/test/java/io/chucknorris/api/configuration/HerokuDataSourcePropertiesTest.java rename to chucknorris-web/src/test/java/io/chucknorris/api/configuration/HerokuDataSourcePropertiesTest.java diff --git a/src/test/java/io/chucknorris/api/feed/FeedControllerTest.java b/chucknorris-web/src/test/java/io/chucknorris/api/feed/FeedControllerTest.java similarity index 100% rename from src/test/java/io/chucknorris/api/feed/FeedControllerTest.java rename to chucknorris-web/src/test/java/io/chucknorris/api/feed/FeedControllerTest.java diff --git a/src/test/java/io/chucknorris/api/feed/dailychuck/DailyChuckRssTest.java b/chucknorris-web/src/test/java/io/chucknorris/api/feed/dailychuck/DailyChuckRssTest.java similarity index 100% rename from src/test/java/io/chucknorris/api/feed/dailychuck/DailyChuckRssTest.java rename to chucknorris-web/src/test/java/io/chucknorris/api/feed/dailychuck/DailyChuckRssTest.java diff --git a/src/test/java/io/chucknorris/api/feed/dailychuck/DailyChuckTest.java b/chucknorris-web/src/test/java/io/chucknorris/api/feed/dailychuck/DailyChuckTest.java similarity index 100% rename from src/test/java/io/chucknorris/api/feed/dailychuck/DailyChuckTest.java rename to chucknorris-web/src/test/java/io/chucknorris/api/feed/dailychuck/DailyChuckTest.java diff --git a/src/test/java/io/chucknorris/api/joke/JokeControllerTest.java b/chucknorris-web/src/test/java/io/chucknorris/api/joke/JokeControllerTest.java similarity index 100% rename from src/test/java/io/chucknorris/api/joke/JokeControllerTest.java rename to chucknorris-web/src/test/java/io/chucknorris/api/joke/JokeControllerTest.java diff --git a/src/test/java/io/chucknorris/api/joke/JokeServiceTest.java b/chucknorris-web/src/test/java/io/chucknorris/api/joke/JokeServiceTest.java similarity index 100% rename from src/test/java/io/chucknorris/api/joke/JokeServiceTest.java rename to chucknorris-web/src/test/java/io/chucknorris/api/joke/JokeServiceTest.java diff --git a/src/test/java/io/chucknorris/api/slack/SlackControllerTest.java b/chucknorris-web/src/test/java/io/chucknorris/api/slack/SlackControllerTest.java similarity index 100% rename from src/test/java/io/chucknorris/api/slack/SlackControllerTest.java rename to chucknorris-web/src/test/java/io/chucknorris/api/slack/SlackControllerTest.java diff --git a/src/test/java/io/chucknorris/api/slack/SlackServiceTest.java b/chucknorris-web/src/test/java/io/chucknorris/api/slack/SlackServiceTest.java similarity index 100% rename from src/test/java/io/chucknorris/api/slack/SlackServiceTest.java rename to chucknorris-web/src/test/java/io/chucknorris/api/slack/SlackServiceTest.java diff --git a/src/test/java/io/chucknorris/lib/event/EventServiceTest.java b/chucknorris-web/src/test/java/io/chucknorris/lib/event/EventServiceTest.java similarity index 100% rename from src/test/java/io/chucknorris/lib/event/EventServiceTest.java rename to chucknorris-web/src/test/java/io/chucknorris/lib/event/EventServiceTest.java diff --git a/postman/io.chucknorris.api.postman_collection.json b/postman/io.chucknorris.api.postman_collection.json deleted file mode 100644 index 68eab98..0000000 --- a/postman/io.chucknorris.api.postman_collection.json +++ /dev/null @@ -1,3170 +0,0 @@ -{ - "info": { - "_postman_id": "2f0a0785-ba92-4cde-86c6-5a6e11259912", - "name": "io.chucknorris.api", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Actuator", - "item": [ - { - "name": "Metrics", - "item": [ - { - "name": "/actuator/metrics", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/actuator/metrics", - "host": [ - "{{base_url}}" - ], - "path": [ - "actuator", - "metrics" - ] - } - }, - "response": [] - }, - { - "name": "/actuator/metrics/jvm.memory.used", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/actuator/metrics/jvm.memory.used", - "host": [ - "{{base_url}}" - ], - "path": [ - "actuator", - "metrics", - "jvm.memory.used" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "17884ac0-bc90-4e73-b05c-aca85fdfbee8", - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "id": "9b1eb0fc-0516-4ce0-a607-f89dd07e37fa", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "_postman_isSubFolder": true - }, - { - "name": "/actuator", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/actuator", - "host": [ - "{{base_url}}" - ], - "path": [ - "actuator" - ] - } - }, - "response": [] - }, - { - "name": "/actuator/health", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/actuator/health", - "host": [ - "{{base_url}}" - ], - "path": [ - "actuator", - "health" - ] - } - }, - "response": [] - }, - { - "name": "/actuator/info", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/actuator/info", - "host": [ - "{{base_url}}" - ], - "path": [ - "actuator", - "info" - ] - } - }, - "response": [] - }, - { - "name": "/actuator/prometheus", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/actuator/prometheus", - "host": [ - "{{base_url}}" - ], - "path": [ - "actuator", - "prometheus" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Documentation", - "item": [ - { - "name": "documentation", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/documentation", - "host": [ - "{{base_url}}" - ], - "path": [ - "documentation" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Feed", - "item": [ - { - "name": "/feed/daily-chuck/stats", - "event": [ - { - "listen": "test", - "script": { - "id": "7bfd91a6-f4fd-4d1a-9a18-c03f173685c1", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " pm.expect(tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['MailingListStatistic']", - " )).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "application/json" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/feed/daily-chuck/stats", - "host": [ - "{{base_url}}" - ], - "path": [ - "feed", - "daily-chuck", - "stats" - ] - } - }, - "response": [] - }, - { - "name": "The Daily Chuck (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "7bfd91a6-f4fd-4d1a-9a18-c03f173685c1", - "exec": [ - "var schema = {", - " \"type\": \"object\",", - " \"required\": [", - " \"issue_number\",", - " \"issues\"", - " ],", - " \"properties\": {", - " \"issue_number\": {", - " \"type\": \"integer\"", - " },", - " \"issues\": {", - " \"type\": \"array\",", - " \"items\": {", - " \"type\": \"object\",", - " \"required\": [", - " \"date\",", - " \"joke_id\"", - " ],", - " \"properties\": {", - " \"date\": {", - " \"type\": \"string\"", - " },", - " \"joke_id\": {", - " \"type\": \"string\"", - " }", - " }", - " }", - " }", - " }", - "};", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " var jsonData = pm.response.json();", - " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json", - "type": "text" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/feed/daily-chuck", - "host": [ - "{{base_url}}" - ], - "path": [ - "feed", - "daily-chuck" - ] - } - }, - "response": [] - }, - { - "name": "The Daily Chuck (xml)", - "event": [ - { - "listen": "test", - "script": { - "id": "07d8186d-d500-47c7-8ce6-4861bc6d79d1", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/rss+xml;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has title and description\", function () {", - " var body = xml2Json(responseBody);", - " pm.expect(body.rss.channel.title).to.equal(\"The Daily Chuck\");", - " pm.expect(body.rss.channel.link).to.equal(\"https://api.chucknorris.io/feed/daily-chuck.xml\");", - " pm.expect(body.rss.channel.description).to.equal(\"Get your daily dose of the best #ChuckNorrisFacts every morning straight into your inbox.\");", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/xml", - "type": "text" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/feed/daily-chuck", - "host": [ - "{{base_url}}" - ], - "path": [ - "feed", - "daily-chuck" - ], - "query": [ - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Integration", - "item": [ - { - "name": "Slack", - "item": [ - { - "name": "chuck", - "item": [ - { - "name": "random joke", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " const result = tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['SlackCommandResponse']", - " );", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "c4bbd59b-e267-4f62-9549-955701707dbe", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/integration/slack?token=deprecated&team_id=Txxxxxxxx&team_domain={{team_domain}}&channel_id=Dxxxxxxxx&channel_name=directmessage&user_id=Uxxxxxxxx&user_name=jean-claude-van-damme&command=/joke&text=&response_url=https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx&trigger_id=xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "host": [ - "{{base_url}}" - ], - "path": [ - "integration", - "slack" - ], - "query": [ - { - "key": "token", - "value": "deprecated" - }, - { - "key": "team_id", - "value": "Txxxxxxxx" - }, - { - "key": "team_domain", - "value": "{{team_domain}}" - }, - { - "key": "channel_id", - "value": "Dxxxxxxxx" - }, - { - "key": "channel_name", - "value": "directmessage" - }, - { - "key": "user_id", - "value": "Uxxxxxxxx" - }, - { - "key": "user_name", - "value": "jean-claude-van-damme" - }, - { - "key": "command", - "value": "/joke" - }, - { - "key": "text", - "value": "" - }, - { - "key": "response_url", - "value": "https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "trigger_id", - "value": "xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "free text search", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " const result = tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['SlackCommandResponse']", - " );", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/x-www-form-urlencoded" - } - ], - "url": { - "raw": "{{base_url}}/integration/slack?token=deprecated&team_id=Txxxxxxxx&team_domain={{team_domain}}&channel_id=Dxxxxxxxx&channel_name=directmessage&user_id=Uxxxxxxxx&user_name=jean-claude-van-damme&command=/joke&text=? Chuck&response_url=https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx&trigger_id=xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "host": [ - "{{base_url}}" - ], - "path": [ - "integration", - "slack" - ], - "query": [ - { - "key": "token", - "value": "deprecated" - }, - { - "key": "team_id", - "value": "Txxxxxxxx" - }, - { - "key": "team_domain", - "value": "{{team_domain}}" - }, - { - "key": "channel_id", - "value": "Dxxxxxxxx" - }, - { - "key": "channel_name", - "value": "directmessage" - }, - { - "key": "user_id", - "value": "Uxxxxxxxx" - }, - { - "key": "user_name", - "value": "jean-claude-van-damme" - }, - { - "key": "command", - "value": "/joke" - }, - { - "key": "text", - "value": "? Chuck" - }, - { - "key": "response_url", - "value": "https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "trigger_id", - "value": "xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "random joke from category", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " const result = tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['SlackCommandResponse']", - " );", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/x-www-form-urlencoded" - } - ], - "url": { - "raw": "{{base_url}}/integration/slack?token=deprecated&team_id=Txxxxxxxx&team_domain={{team_domain}}&channel_id=Dxxxxxxxx&channel_name=directmessage&user_id=Uxxxxxxxx&user_name=jean-claude-van-damme&command=/joke&text=dev&response_url=https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx&trigger_id=xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "host": [ - "{{base_url}}" - ], - "path": [ - "integration", - "slack" - ], - "query": [ - { - "key": "token", - "value": "deprecated" - }, - { - "key": "team_id", - "value": "Txxxxxxxx" - }, - { - "key": "team_domain", - "value": "{{team_domain}}" - }, - { - "key": "channel_id", - "value": "Dxxxxxxxx" - }, - { - "key": "channel_name", - "value": "directmessage" - }, - { - "key": "user_id", - "value": "Uxxxxxxxx" - }, - { - "key": "user_name", - "value": "jean-claude-van-damme" - }, - { - "key": "command", - "value": "/joke" - }, - { - "key": "text", - "value": "dev" - }, - { - "key": "response_url", - "value": "https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "trigger_id", - "value": "xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "random personalized joke", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " const result = tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['SlackCommandResponse']", - " );", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/x-www-form-urlencoded" - } - ], - "url": { - "raw": "{{base_url}}/integration/slack?token=deprecated&team_id=Txxxxxxxx&team_domain={{team_domain}}&channel_id=Dxxxxxxxx&channel_name=directmessage&user_id=Uxxxxxxxx&user_name=jean-claude-van-damme&command=/joke&text=@ Bob&response_url=https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx&trigger_id=xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "host": [ - "{{base_url}}" - ], - "path": [ - "integration", - "slack" - ], - "query": [ - { - "key": "token", - "value": "deprecated" - }, - { - "key": "team_id", - "value": "Txxxxxxxx" - }, - { - "key": "team_domain", - "value": "{{team_domain}}" - }, - { - "key": "channel_id", - "value": "Dxxxxxxxx" - }, - { - "key": "channel_name", - "value": "directmessage" - }, - { - "key": "user_id", - "value": "Uxxxxxxxx" - }, - { - "key": "user_name", - "value": "jean-claude-van-damme" - }, - { - "key": "command", - "value": "/joke" - }, - { - "key": "text", - "value": "@ Bob" - }, - { - "key": "response_url", - "value": "https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "trigger_id", - "value": "xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "categories", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " const result = tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['SlackCommandResponse']", - " );", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/x-www-form-urlencoded" - } - ], - "url": { - "raw": "{{base_url}}/integration/slack?token=deprecated&team_id=Txxxxxxxx&team_domain={{team_domain}}&channel_id=Dxxxxxxxx&channel_name=directmessage&user_id=Uxxxxxxxx&user_name=jean-claude-van-damme&command=/joke&text=-cat&response_url=https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx&trigger_id=xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "host": [ - "{{base_url}}" - ], - "path": [ - "integration", - "slack" - ], - "query": [ - { - "key": "token", - "value": "deprecated" - }, - { - "key": "team_id", - "value": "Txxxxxxxx" - }, - { - "key": "team_domain", - "value": "{{team_domain}}" - }, - { - "key": "channel_id", - "value": "Dxxxxxxxx" - }, - { - "key": "channel_name", - "value": "directmessage" - }, - { - "key": "user_id", - "value": "Uxxxxxxxx" - }, - { - "key": "user_name", - "value": "jean-claude-van-damme" - }, - { - "key": "command", - "value": "/joke" - }, - { - "key": "text", - "value": "-cat" - }, - { - "key": "response_url", - "value": "https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "trigger_id", - "value": "xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "get joke by id", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " const result = tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['SlackCommandResponse']", - " );", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/x-www-form-urlencoded" - } - ], - "url": { - "raw": "{{base_url}}/integration/slack?token=deprecated&team_id=Txxxxxxxx&team_domain={{team_domain}}&channel_id=Dxxxxxxxx&channel_name=directmessage&user_id=Uxxxxxxxx&user_name=jean-claude-van-damme&command=/joke&text=: bwoz2uwsqnwmyawyxdvo1w&response_url=https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx&trigger_id=xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "host": [ - "{{base_url}}" - ], - "path": [ - "integration", - "slack" - ], - "query": [ - { - "key": "token", - "value": "deprecated" - }, - { - "key": "team_id", - "value": "Txxxxxxxx" - }, - { - "key": "team_domain", - "value": "{{team_domain}}" - }, - { - "key": "channel_id", - "value": "Dxxxxxxxx" - }, - { - "key": "channel_name", - "value": "directmessage" - }, - { - "key": "user_id", - "value": "Uxxxxxxxx" - }, - { - "key": "user_name", - "value": "jean-claude-van-damme" - }, - { - "key": "command", - "value": "/joke" - }, - { - "key": "text", - "value": ": bwoz2uwsqnwmyawyxdvo1w" - }, - { - "key": "response_url", - "value": "https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "trigger_id", - "value": "xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "help", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " const result = tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['SlackCommandResponse']", - " );", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Content-Type", - "type": "text", - "value": "application/x-www-form-urlencoded" - } - ], - "url": { - "raw": "{{base_url}}/integration/slack?token=deprecated&team_id=Txxxxxxxx&team_domain={{team_domain}}&channel_id=Dxxxxxxxx&channel_name=directmessage&user_id=Uxxxxxxxx&user_name=jean-claude-van-damme&command=/joke&text=help&response_url=https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx&trigger_id=xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "host": [ - "{{base_url}}" - ], - "path": [ - "integration", - "slack" - ], - "query": [ - { - "key": "token", - "value": "deprecated" - }, - { - "key": "team_id", - "value": "Txxxxxxxx" - }, - { - "key": "team_domain", - "value": "{{team_domain}}" - }, - { - "key": "channel_id", - "value": "Dxxxxxxxx" - }, - { - "key": "channel_name", - "value": "directmessage" - }, - { - "key": "user_id", - "value": "Uxxxxxxxx" - }, - { - "key": "user_name", - "value": "jean-claude-van-damme" - }, - { - "key": "command", - "value": "/joke" - }, - { - "key": "text", - "value": "help" - }, - { - "key": "response_url", - "value": "https://hooks.slack.com/commands/team_id/xxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "trigger_id", - "value": "xxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - }, - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - } - ], - "_postman_isSubFolder": true - } - ] - }, - { - "name": "Jokes", - "item": [ - { - "name": "Categories", - "item": [ - { - "name": "/jokes/categories (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "b95a04f7-d3d2-4724-8a80-24536ee8041c", - "exec": [ - "var schema = {", - " \"type\": \"array\",", - " \"items\": {", - " \"type\": \"string\"", - " }", - "}", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " var jsonData = pm.response.json();", - " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/categories", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "categories" - ] - }, - "description": "Retrieve a list of available joke categories." - }, - "response": [ - { - "name": "/jokes/categories (json)", - "originalRequest": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/categories", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "categories" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Date", - "value": "Sat, 08 Jun 2019 09:50:25 GMT" - }, - { - "key": "Content-Type", - "value": "application/json;charset=UTF-8" - }, - { - "key": "Transfer-Encoding", - "value": "chunked" - }, - { - "key": "Connection", - "value": "keep-alive" - }, - { - "key": "Vary", - "value": "Origin" - }, - { - "key": "Vary", - "value": "Access-Control-Request-Method" - }, - { - "key": "Vary", - "value": "Access-Control-Request-Headers" - }, - { - "key": "Access-Control-Allow-Origin", - "value": "*" - }, - { - "key": "Access-Control-Allow-Credentials", - "value": "true" - }, - { - "key": "Via", - "value": "1.1 vegur" - }, - { - "key": "Expect-CT", - "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"" - }, - { - "key": "Server", - "value": "cloudflare" - }, - { - "key": "CF-RAY", - "value": "4e39f61e2a44d10d-TXL" - }, - { - "key": "Content-Encoding", - "value": "gzip" - } - ], - "cookie": [], - "body": "[\n \"animal\",\n \"career\",\n \"celebrity\",\n \"dev\",\n \"explicit\",\n \"fashion\",\n \"food\",\n \"history\",\n \"money\",\n \"movie\",\n \"music\",\n \"political\",\n \"religion\",\n \"science\",\n \"sport\",\n \"travel\"\n]" - } - ] - }, - { - "name": "/jokes/categories (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "1fafa3d8-8662-47ec-b151-31e633608c64", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has a non-empty body\", function () {", - " pm.expect(pm.response.text().length).to.be.above(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/categories", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "categories" - ] - }, - "description": "Retrieve a list of available joke categories." - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Random", - "item": [ - { - "name": "errors", - "item": [ - { - "name": "404 - Category not found (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "var schema = {", - " \"timestamp\": {", - " \"type\": \"string\"", - " },", - " \"status\": {", - " \"type\": \"integer\"", - " },", - " \"error\": {", - " \"type\": \"string\"", - " },", - " \"message\": {", - " \"type\": \"string\"", - " },", - " \"path\": {", - " \"type\": \"string\"", - " }", - "}", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " var jsonData = pm.response.json();", - " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?category=category-does-not-exist", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "category", - "value": "category-does-not-exist" - }, - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "404 - Category not found (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "var schema = {", - " \"timestamp\": {", - " \"type\": \"string\"", - " },", - " \"status\": {", - " \"type\": \"integer\"", - " },", - " \"error\": {", - " \"type\": \"string\"", - " },", - " \"message\": {", - " \"type\": \"string\"", - " },", - " \"path\": {", - " \"type\": \"string\"", - " }", - "}", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "text/plain" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?category=category-does-not-exist", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "category", - "value": "category-does-not-exist" - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "/jokes/random (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " pm.expect(tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['Joke']", - " )).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "61dcfdc3-e3ff-47bd-b1bf-8cf0066dd743", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "6628d54d-4327-418d-9601-e9538aa1b9df", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has a non-empty body\", function () {", - " pm.expect(pm.response.text().length).to.be.above(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "type": "text", - "value": "text/plain" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random with category (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " pm.expect(tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['Joke']", - " )).to.be.true;", - "});", - "", - "pm.test(\"Has categories = ['dev']\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.categories).to.eql(['dev']);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "98dbb6d3-2154-4a5b-a150-9f161c72434c", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?category=dev", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "category", - "value": "dev" - } - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random with category (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has a non-empty body\", function () {", - " pm.expect(pm.response.text().length).to.be.above(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?category=dev", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "category", - "value": "dev" - } - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random with categories (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " pm.expect(tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['Joke']", - " )).to.be.true;", - "});", - "", - "pm.test(\"Has categories = ['dev'] or ['movie']\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.categories).satisfy(category => {", - " return (category[0] === 'dev') || category[0] === 'movie'", - " });", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "98dbb6d3-2154-4a5b-a150-9f161c72434c", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?category=dev,movie", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "category", - "value": "dev,movie" - } - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random with categories (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has a non-empty body\", function () {", - " pm.expect(pm.response.text().length).to.be.above(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?category=dev,movie", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "category", - "value": "dev,movie" - } - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random personalised (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " pm.expect(tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['Joke']", - " )).to.be.true;", - "});", - "", - "pm.test('Joke value contains \"Bob\"', function() {", - " pm.expect(pm.response.json().value).to.include(\"Bob\");", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "41ffca73-01aa-4567-bbff-fd7d641a0da6", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?name=Bob", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "name", - "value": "Bob" - } - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random personalised (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has a non-empty body\", function () {", - " pm.expect(pm.response.text().length).to.be.above(0);", - "});", - "", - "pm.test('Body contains \"Bob\"', function() {", - " pm.expect(pm.response.text()).to.include(\"Bob\");", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "41ffca73-01aa-4567-bbff-fd7d641a0da6", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?name=Bob", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "name", - "value": "Bob" - } - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random personalised with category (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " pm.expect(tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['Joke']", - " )).to.be.true;", - "});", - "", - "pm.test('Joke value contains \"Bob\"', function() {", - " pm.expect(pm.response.json().value).to.include(\"Bob\");", - "});", - "", - "pm.test(\"Has categories = ['dev']\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData.categories).satisfy(category => {", - " return (category[0] === 'dev')", - " });", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "41ffca73-01aa-4567-bbff-fd7d641a0da6", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?name=Bob&category=dev", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "name", - "value": "Bob" - }, - { - "key": "category", - "value": "dev" - } - ] - } - }, - "response": [] - }, - { - "name": "/jokes/random personalised with category (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has a non-empty body\", function () {", - " pm.expect(pm.response.text().length).to.be.above(0);", - "});", - "", - "pm.test('Body contains \"Bob\"', function() {", - " pm.expect(pm.response.text()).to.include(\"Bob\");", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "41ffca73-01aa-4567-bbff-fd7d641a0da6", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/random?name=Bob&category=dev", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "random" - ], - "query": [ - { - "key": "name", - "value": "Bob" - }, - { - "key": "category", - "value": "dev" - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Search", - "item": [ - { - "name": "errors", - "item": [ - { - "name": "400 - Bad Request (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "fc247793-9e2b-41a3-8d48-aa4dad010a3f", - "exec": [ - "var schema = {", - " \"type\": \"object\",", - " \"required\": [", - " \"timestamp\",", - " \"status\",", - " \"error\",", - " \"message\",", - " \"violations\"", - " ],", - " \"properties\": {", - " \"timestamp\": {", - " \"type\": \"string\"", - " },", - " \"status\": {", - " \"type\": \"integer\"", - " },", - " \"error\": {", - " \"type\": \"string\"", - " },", - " \"message\": {", - " \"type\": \"string\"", - " },", - " \"violations\": {", - " \"type\": \"object\"", - " }", - " }", - "};", - "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " var jsonData = pm.response.json();", - " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/search?query=", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "search" - ], - "query": [ - { - "key": "query", - "value": "" - } - ] - }, - "description": "Free text search." - }, - "response": [] - }, - { - "name": "400 -Bad Request (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has a non-empty body\", function () {", - " pm.expect(pm.response.text().length).to.be.above(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain", - "type": "text" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/search?query=", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "search" - ], - "query": [ - { - "key": "query", - "value": "" - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "/jokes/search (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "fc247793-9e2b-41a3-8d48-aa4dad010a3f", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " pm.expect(tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['JokeSearchResult']", - " )).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "a20686e1-d58a-4e65-874a-5447a7799048", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/search?query=roundhouse", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "search" - ], - "query": [ - { - "key": "query", - "value": "roundhouse" - } - ] - }, - "description": "Free text search." - }, - "response": [] - }, - { - "name": "/jokes/search (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "675e0429-432d-4b51-b425-97f5c7385153", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Has a non-empty body\", function () {", - " pm.expect(pm.response.text().length).to.be.above(0);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/search?query=roundhouse", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "search" - ], - "query": [ - { - "key": "query", - "value": "roundhouse" - } - ] - }, - "description": "Free text search." - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "errors", - "item": [ - { - "name": "404 - Joke not found (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "var schema = {", - " \"timestamp\": {", - " \"type\": \"string\"", - " },", - " \"status\": {", - " \"type\": \"integer\"", - " },", - " \"error\": {", - " \"type\": \"string\"", - " },", - " \"message\": {", - " \"type\": \"string\"", - " },", - " \"path\": {", - " \"type\": \"string\"", - " }", - "}", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " var jsonData = pm.response.json();", - " pm.expect(tv4.validate(jsonData, schema)).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/bwoz2uwsqnwmyawyxdvo1z", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "bwoz2uwsqnwmyawyxdvo1z" - ], - "query": [ - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "404 - Joke not found (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain", - "type": "text" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/bwoz2uwsqnwmyawyxdvo1z", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "bwoz2uwsqnwmyawyxdvo1z" - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "/jokes/{id} (html)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/html;charset=UTF-8\"", - " );", - "});", - "", - "var $ = cheerio.load(pm.response.text())", - "", - "pm.test(\"Matches title\", () => { ", - " pm.expect($('title').text()).to.not.be.empty;", - " pm.expect($('title').text()).to.equal('Chuck Norris finished World of Warcraft.');", - "});", - "", - "pm.test('Includes a joke', () => {", - " pm.expect($('#joke_value').text()).to.equal('Chuck Norris finished World of Warcraft.');", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/html" - }, - { - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "key": "Origin", - "type": "text", - "value": "*" - } - ], - "url": { - "raw": "{{base_url}}/jokes/bwoz2uwsqnwmyawyxdvo1w", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "bwoz2uwsqnwmyawyxdvo1w" - ] - } - }, - "response": [] - }, - { - "name": "/jokes/{id} (json)", - "event": [ - { - "listen": "test", - "script": { - "id": "670a9e46-d8a4-4c21-8a33-d409a7efb4cb", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"application/json;charset=UTF-8\"", - " );", - "});", - "", - "pm.test('Schema is valid', function() {", - " pm.expect(tv4.validate(", - " pm.response.json(),", - " pm.environment.get(\"schema\").definitions['Joke']", - " )).to.be.true;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "id": "41ffca73-01aa-4567-bbff-fd7d641a0da6", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "application/json" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/bwoz2uwsqnwmyawyxdvo1w", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "bwoz2uwsqnwmyawyxdvo1w" - ] - } - }, - "response": [] - }, - { - "name": "/jokes/{id} (text)", - "event": [ - { - "listen": "test", - "script": { - "id": "6628d54d-4327-418d-9601-e9538aa1b9df", - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Headers are correct\", function () {", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Origin\",", - " \"*\"", - " );", - " pm.response.to.be.header(", - " \"Access-Control-Allow-Credentials\",", - " \"true\"", - " );", - " pm.response.to.be.header(", - " \"Content-Type\",", - " \"text/plain;charset=UTF-8\"", - " );", - "});", - "", - "pm.test(\"Body matches string\", function () {", - " pm.expect(pm.response.text()).to.include(\"Chuck Norris finished World of Warcraft.\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "text/plain", - "type": "text" - }, - { - "key": "Origin", - "value": "*", - "description": "The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.", - "type": "text" - } - ], - "url": { - "raw": "{{base_url}}/jokes/bwoz2uwsqnwmyawyxdvo1w", - "host": [ - "{{base_url}}" - ], - "path": [ - "jokes", - "bwoz2uwsqnwmyawyxdvo1w" - ] - } - }, - "response": [] - } - ] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "3ea14d7d-d97c-4ea1-a5cb-d5fdc6aac1db", - "type": "text/javascript", - "exec": [ - "const setSchema = (baseUrl) => {", - " if (!baseUrl) {", - " throw new Error('Argument \"baseUrl\" must be a non-empty string.');", - " }", - " ", - " const env = pm.environment.name;", - " const schema = pm.environment.get(\"schema\");", - " if (!schema) {", - " const url = `${baseUrl}/documentation`;", - " pm.sendRequest(url, function (err, response) {", - " if (err) {", - " throw new Error(`Could not fetch swagger documentation from \"${url}\"`);", - " } else {", - " console.info(`Set environment variable \"schema\" successfully.`);", - " pm.environment.set(\"schema\", response.json());", - " }", - " });", - " }", - "}", - "", - "setSchema(", - " pm.environment.get('base_url')", - ");" - ] - } - }, - { - "listen": "test", - "script": { - "id": "023ae7ea-5b4e-4752-9fbe-fa9a16988776", - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] -} \ No newline at end of file diff --git a/postman/local.postman_environment.json b/postman/local.postman_environment.json deleted file mode 100644 index d924387..0000000 --- a/postman/local.postman_environment.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "id": "b9bccd47-fabd-484a-a752-28ddfac717db", - "name": "local", - "values": [ - { - "key": "base_url", - "value": "http://localhost:8080", - "enabled": true - }, - { - "key": "team_domain", - "value": "ACME Inc", - "enabled": true - } - ], - "_postman_variable_scope": "environment", - "_postman_exported_at": "2019-06-14T19:02:47.886Z", - "_postman_exported_using": "Postman/7.2.0" -} \ No newline at end of file diff --git a/postman/production.postman_environment.json b/postman/production.postman_environment.json deleted file mode 100644 index 13f093e..0000000 --- a/postman/production.postman_environment.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "id": "ffcd9c59-ecfe-4248-b7ca-642e3dc5263e", - "name": "production", - "values": [ - { - "key": "base_url", - "value": "https://api.chucknorris.io", - "enabled": true - }, - { - "key": "team_domain", - "value": "ACME Inc", - "enabled": true - } - ], - "_postman_variable_scope": "environment", - "_postman_exported_at": "2019-06-14T19:03:07.438Z", - "_postman_exported_using": "Postman/7.2.0" -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 484b309..9c51228 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,12 @@ -rootProject.name = 'io.chucknorris.api' +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/7.3.2/userguide/multi_project_builds.html + */ + +rootProject.name = 'chucknorris' + +include("chucknorris-web")