Skip to content

Commit

Permalink
Merge pull request #50 from speekha/develop
Browse files Browse the repository at this point in the history
Publish 1.1.6
  • Loading branch information
speekha authored Aug 9, 2019
2 parents 4c88b2b + 9a3e8d9 commit a45c787
Show file tree
Hide file tree
Showing 74 changed files with 2,562 additions and 1,447 deletions.
28 changes: 15 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ commands:
jobs:
prepare_dependencies:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
#TERM: dumb
Expand Down Expand Up @@ -66,55 +66,55 @@ jobs:
- "."
build_core:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
- build-module:
module: "mocker"
build_jackson:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
- build-module:
module: "jackson-adapter"
build_gson:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
- build-module:
module: "gson-adapter"
build_moshi:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
- build-module:
module: "moshi-adapter"
build_custom:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
- build-module:
module: "custom-adapter"
build_kotlinx:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
- build-module:
module: "kotlinx-adapter"
build_demo:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
- demo/build
store_artifacts:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
destination: apks
test:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
Expand Down Expand Up @@ -219,19 +219,21 @@ jobs:
- build-kotlinx-adapter-{{ .Branch }}-{{ .Revision }}
- run:
name: Tests
command: ./gradlew tests:test --stacktrace
command: ./gradlew tests:test demo:test --stacktrace
- store_artifacts:
path: tests/build/reports
destination: reports
- store_test_results:
path: tests/build/test-results
- store_test_results:
path: demo/build/test-results
- save_cache:
key: build-{{ .Branch }}-{{ .Revision }}
paths:
- "."
publish_snapshot:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
steps:
- restore_cache:
key: build-{{ .Branch }}-{{ .Revision }}
Expand All @@ -242,7 +244,7 @@ jobs:
command: ./publishSnapshot.sh ${BINTRAY_USER} ${BINTRAY_APIKEY}
publish_release:
docker:
- image: circleci/android:api-28
- image: circleci/android:api-29
steps:
- restore_cache:
key: build-{{ .Branch }}-{{ .Revision }}
Expand Down
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ configuration files instead. The interceptor will also allow to record scenarios
## Current Version

```gradle
httpmocker_version = '1.1.5'
httpmocker_version = '1.1.6'
```

## Gradle
Expand Down Expand Up @@ -55,27 +55,27 @@ you need to add is the corresponding

```gradle
// Parses JSON scenarios using Jackson
implementation "fr.speekha.httpmocker:jackson-adapter:1.1.5"
implementation "fr.speekha.httpmocker:jackson-adapter:1.1.6"
// Parses JSON scenarios using Gson
implementation "fr.speekha.httpmocker:gson-adapter:1.1.5"
implementation "fr.speekha.httpmocker:gson-adapter:1.1.6"
// Parses JSON scenarios using Moshi
implementation "fr.speekha.httpmocker:moshi-adapter:1.1.5"
implementation "fr.speekha.httpmocker:moshi-adapter:1.1.6"
// Parses JSON scenarios using Kotlinx Serialization
implementation "fr.speekha.httpmocker:kotlinx-adapter:1.1.5"
implementation "fr.speekha.httpmocker:kotlinx-adapter:1.1.6"
// Parses JSON scenarios using a custom JSON parser
implementation "fr.speekha.httpmocker:custom-adapter:1.1.5"
implementation "fr.speekha.httpmocker:custom-adapter:1.1.6"
```

If none of those options suits your needs or if you would prefer to only use dynamic mocks, you can add
the main dependency to your project (using static mocks will require that you provide your own implementation
of the `Mapper` class):

```gradle
implementation "fr.speekha.httpmocker:mocker:1.1.5"
implementation "fr.speekha.httpmocker:mocker:1.1.6"
```

#### External dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ internal fun Matcher.toJson(): String = """ {
"""

internal fun RequestDescriptor.toJson(): String = listOf(
"exact-match" to exactMatch.takeIf { it },
"protocol" to protocol.wrap(),
"method" to method.wrap(),
"host" to host.wrap(),
Expand All @@ -55,14 +56,14 @@ internal fun RequestDescriptor.toJson(): String = listOf(
postfix = "\n }"
) { (key, value) -> " \"$key\": $value" }

internal fun <K, V> Map<K, V>.toJson(): String =
internal fun Map<String, String?>.toJson(): String =
entries.joinToString(
separator = ",\n",
prefix = "{\n",
postfix = "\n }"
) { " \"${it.key}\": \"${it.value}\"" }
) { " \"${it.key}\": ${it.value.wrap()}" }

internal fun Header.toJson(): String = "\"$name\": \"$value\""
internal fun Header.toJson(): String = "\"$name\": ${value.wrap()}"

internal fun ResponseDescriptor.toJson(): String = listOf(
"delay" to delay.toString(),
Expand All @@ -79,7 +80,7 @@ internal fun ResponseDescriptor.toJson(): String = listOf(
postfix = "\n }"
) { (key, value) -> " \"$key\": $value" }

private fun String?.wrap() = this?.let { "\"$it\"" }
private fun String?.wrap() = this?.let { "\"${it.replace("\"", "\\\"")}\"" }

private fun Int?.wrap() = this?.toString()

Expand Down
Loading

0 comments on commit a45c787

Please sign in to comment.