Skip to content

Commit 1842884

Browse files
authored
Adding image deletion to demo (#55)
- added additional license headers to various source files <!-- Please describe your pull request here. --> ## References - TODO <!-- References to relevant GitHub issues and pull requests, esp. upstream and downstream changes --> ## Submitter checklist - [ ] Recommended: Join [WireMock Slack](https://slack.wiremock.org/) to get any help in `#help-contributing` or a project-specific channel like `#wiremock-java` - [ ] Recommended: If you participate in Hacktoberfest 2023, maake sure you're [signed up](https://wiremock.org/events/hacktoberfest/) there and in the WireMock form - [ ] The PR request is well described and justified, including the body and the references - [ ] The PR title represents the desired changelog entry - [ ] The repository's code style is followed (see the contributing guide) - [ ] Test coverage that demonstrates that the change works as expected - [ ] For new features, there's necessary documentation in this pull request or in a subsequent PR to [wiremock.org](https://github.com/wiremock/wiremock.org) <!-- Put an `x` into the [ ] to show you have filled the information. The template comes from https://github.com/wiremock/.github/blob/main/.github/pull_request_template.md You can override it by creating .github/pull_request_template.md in your own repository -->
1 parent d1270d6 commit 1842884

File tree

7 files changed

+102
-2
lines changed

7 files changed

+102
-2
lines changed

demo/stubs/mappings/profile.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,27 @@
107107
}
108108
}
109109
]
110+
},
111+
{
112+
"request": {
113+
"urlPathPattern": "/api/v1/profile/image",
114+
"method": "DELETE"
115+
},
116+
"response": {
117+
"status": 204
118+
},
119+
"serveEventListeners": [
120+
{
121+
"name": "recordState",
122+
"parameters": {
123+
"state": {
124+
"image": "null",
125+
"imageContentType": "null"
126+
},
127+
"context": "profile"
128+
}
129+
}
130+
]
110131
}
111132
]
112133
}

demo/wiremock_state_extension_demo/src/components/navigation-header/navigation-header.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ function loadAvatar() {
2424
image.value = response.data
2525
hasImage.value = true
2626
})
27-
.catch(() => loadInitials())
27+
.catch(() => {
28+
image.value = null
29+
hasImage.value = false
30+
loadInitials()
31+
})
2832
}
2933
3034
function loadInitials() {
@@ -49,7 +53,7 @@ function loadInitials() {
4953
</template>
5054
<template v-slot:append>
5155
<v-avatar color="primary" size="48" @click="$router.push('/profile')">
52-
<template v-if="image !== null">
56+
<template v-if="hasImage">
5357
<v-img :src="image" alt="profile image preview"></v-img>
5458
</template>
5559
<template v-else>

src/main/java/org/wiremock/extensions/state/internal/DeleteStateParameters.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright (C) 2023 Dirk Bolte
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.wiremock.extensions.state.internal;
217

318
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

src/main/java/org/wiremock/extensions/state/internal/RecordStateParameters.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright (C) 2023 Dirk Bolte
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.wiremock.extensions.state.internal;
217

318
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

src/main/java/org/wiremock/extensions/state/internal/StateExtensionMixin.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright (C) 2023 Dirk Bolte
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.wiremock.extensions.state.internal;
217

318
import com.github.tomakehurst.wiremock.core.ConfigurationException;

src/main/java/org/wiremock/extensions/state/internal/StateRequestMatcherParameters.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright (C) 2023 Dirk Bolte
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.wiremock.extensions.state.internal;
217

318
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

src/test/java/org/wiremock/extensions/state/functionality/AbstractTestBase.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright (C) 2023 Dirk Bolte
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.wiremock.extensions.state.functionality;
217

318
import com.fasterxml.jackson.databind.ObjectMapper;

0 commit comments

Comments
 (0)