1 | package com.fwmotion.threescale.cms; | |
2 | ||
3 | import com.fwmotion.threescale.cms.exception.ThreescaleCmsCannotDeleteBuiltinException; | |
4 | import com.fwmotion.threescale.cms.exception.ThreescaleCmsException; | |
5 | import com.fwmotion.threescale.cms.model.*; | |
6 | import jakarta.annotation.Nonnull; | |
7 | ||
8 | import java.io.File; | |
9 | import java.io.InputStream; | |
10 | import java.util.List; | |
11 | import java.util.Objects; | |
12 | import java.util.Optional; | |
13 | import java.util.stream.Collectors; | |
14 | import java.util.stream.Stream; | |
15 | ||
16 | public interface ThreescaleCmsClient { | |
17 | ||
18 | @Nonnull | |
19 | default Stream<CmsObject> streamAllCmsObjects() throws ThreescaleCmsException { | |
20 |
1
1. streamAllCmsObjects : replaced return value with Stream.empty for com/fwmotion/threescale/cms/ThreescaleCmsClient::streamAllCmsObjects → KILLED |
return Stream.of( |
21 | streamSections(), | |
22 | streamFiles(), | |
23 | streamTemplates(false) | |
24 |
1
1. lambda$streamAllCmsObjects$0 : replaced return value with Stream.empty for com/fwmotion/threescale/cms/ThreescaleCmsClient::lambda$streamAllCmsObjects$0 → KILLED |
).flatMap(s -> s); |
25 | } | |
26 | ||
27 | @Nonnull | |
28 | default List<CmsObject> listAllCmsObjects() throws ThreescaleCmsException { | |
29 |
1
1. listAllCmsObjects : replaced return value with Collections.emptyList for com/fwmotion/threescale/cms/ThreescaleCmsClient::listAllCmsObjects → KILLED |
return streamAllCmsObjects() |
30 | .collect(Collectors.toList()); | |
31 | } | |
32 | ||
33 | @Nonnull | |
34 | Stream<CmsSection> streamSections(); | |
35 | ||
36 | @Nonnull | |
37 | default List<CmsSection> listSections() throws ThreescaleCmsException { | |
38 |
1
1. listSections : replaced return value with Collections.emptyList for com/fwmotion/threescale/cms/ThreescaleCmsClient::listSections → KILLED |
return streamSections() |
39 | .collect(Collectors.toList()); | |
40 | } | |
41 | ||
42 | @Nonnull | |
43 | Stream<CmsFile> streamFiles(); | |
44 | ||
45 | @Nonnull | |
46 | default List<CmsFile> listFiles() throws ThreescaleCmsException { | |
47 |
1
1. listFiles : replaced return value with Collections.emptyList for com/fwmotion/threescale/cms/ThreescaleCmsClient::listFiles → KILLED |
return streamFiles() |
48 | .collect(Collectors.toList()); | |
49 | } | |
50 | ||
51 | @Nonnull | |
52 | Optional<InputStream> getFileContent(long fileId) throws ThreescaleCmsException; | |
53 | ||
54 | @Nonnull | |
55 | default Optional<InputStream> getFileContent(@Nonnull CmsFile file) throws ThreescaleCmsException { | |
56 |
1
1. getFileContent : replaced return value with Optional.empty for com/fwmotion/threescale/cms/ThreescaleCmsClient::getFileContent → KILLED |
return Optional.of(file) |
57 | .map(CmsFile::getId) | |
58 | .flatMap(this::getFileContent); | |
59 | } | |
60 | ||
61 | @Nonnull | |
62 | Stream<CmsTemplate> streamTemplates(boolean includeContent); | |
63 | ||
64 | @Nonnull | |
65 | default List<CmsTemplate> listTemplates(boolean includeContent) throws ThreescaleCmsException { | |
66 |
1
1. listTemplates : replaced return value with Collections.emptyList for com/fwmotion/threescale/cms/ThreescaleCmsClient::listTemplates → KILLED |
return streamTemplates(includeContent) |
67 | .collect(Collectors.toList()); | |
68 | } | |
69 | ||
70 | @Nonnull | |
71 | Optional<InputStream> getTemplateDraft(long templateId) throws ThreescaleCmsException; | |
72 | ||
73 | @Nonnull | |
74 | default Optional<InputStream> getTemplateDraft(@Nonnull CmsTemplate template) throws ThreescaleCmsException { | |
75 |
1
1. getTemplateDraft : replaced return value with Optional.empty for com/fwmotion/threescale/cms/ThreescaleCmsClient::getTemplateDraft → KILLED |
return Optional.of(template) |
76 | .map(CmsTemplate::getId) | |
77 | .flatMap(this::getTemplateDraft); | |
78 | } | |
79 | ||
80 | @Nonnull | |
81 | Optional<InputStream> getTemplatePublished(long templateId) throws ThreescaleCmsException; | |
82 | ||
83 | @Nonnull | |
84 | default Optional<InputStream> getTemplatePublished(@Nonnull CmsTemplate template) throws ThreescaleCmsException { | |
85 |
1
1. getTemplatePublished : replaced return value with Optional.empty for com/fwmotion/threescale/cms/ThreescaleCmsClient::getTemplatePublished → KILLED |
return Optional.of(template) |
86 | .map(CmsTemplate::getId) | |
87 | .flatMap(this::getTemplatePublished); | |
88 | } | |
89 | ||
90 | void save(@Nonnull CmsSection section) throws ThreescaleCmsException; | |
91 | ||
92 | void save(@Nonnull CmsFile file, @Nonnull File fileContent) throws ThreescaleCmsException; | |
93 | ||
94 | void save(@Nonnull CmsTemplate template, @Nonnull File draft) throws ThreescaleCmsException; | |
95 | ||
96 | void publish(long templateId) throws ThreescaleCmsException; | |
97 | ||
98 | default void publish(@Nonnull CmsTemplate template) throws ThreescaleCmsException { | |
99 |
1
1. publish : removed call to com/fwmotion/threescale/cms/ThreescaleCmsClient::publish → NO_COVERAGE |
publish(Objects.requireNonNull(template.getId())); |
100 | } | |
101 | ||
102 | void delete(@Nonnull ThreescaleObjectType type, long id) throws ThreescaleCmsException; | |
103 | ||
104 | default void delete(@Nonnull CmsObject object) throws ThreescaleCmsException { | |
105 |
2
1. delete : removed conditional - replaced equality check with false → SURVIVED 2. delete : removed conditional - replaced equality check with true → KILLED |
if (object.isBuiltin()) { |
106 | throw new ThreescaleCmsCannotDeleteBuiltinException(); | |
107 | } | |
108 | ||
109 |
2
1. delete : removed conditional - replaced equality check with true → SURVIVED 2. delete : removed conditional - replaced equality check with false → KILLED |
if (object.getId() != null) { |
110 |
1
1. delete : removed call to com/fwmotion/threescale/cms/ThreescaleCmsClient::delete → KILLED |
delete(object.getType(), object.getId()); |
111 | } | |
112 | } | |
113 | } | |
Mutations | ||
20 |
1.1 |
|
24 |
1.1 |
|
29 |
1.1 |
|
38 |
1.1 |
|
47 |
1.1 |
|
56 |
1.1 |
|
66 |
1.1 |
|
75 |
1.1 |
|
85 |
1.1 |
|
99 |
1.1 |
|
105 |
1.1 2.2 |
|
109 |
1.1 2.2 |
|
110 |
1.1 |