1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.buildcache.its;
20
21 import java.io.File;
22 import java.io.IOException;
23 import java.nio.file.Files;
24 import java.nio.file.Path;
25 import java.nio.file.Paths;
26
27 import org.apache.maven.buildcache.its.junit.IntegrationTest;
28 import org.apache.maven.it.VerificationException;
29 import org.apache.maven.it.Verifier;
30 import org.junit.jupiter.api.Assertions;
31 import org.junit.jupiter.api.Test;
32
33 import static org.apache.maven.buildcache.util.LogFileUtils.findFirstLineContainingTextsInLogs;
34
35
36
37
38
39 @IntegrationTest("src/test/projects/mbuildcache-incremental")
40 public class IncrementalRestoreTest {
41
42 public static final String SAVED_BUILD_TO_LOCAL_FILE = "Saved Build to local file: ";
43 public static final String GENERATED_JAR = "target/mbuildcache-incremental-final.jar";
44 public static final String GENERATED_SOURCES_JAR = "target/mbuildcache-incremental-final-sources.jar";
45 public static final String GENERATED_JAVADOC_JAR = "target/mbuildcache-incremental-final-javadoc.jar";
46
47 public static final String EXTRA_OUTPUT_1 =
48 "target" + File.separatorChar + "extra-resources" + File.separatorChar + "extra-readme-1.md";
49 public static final String EXTRA_OUTPUT_2 = "target/extra-resources/extra-readme-2.md";
50 public static final String EXTRA_OUTPUT_3 = "target/extra-resources/other-readme-1.md";
51 public static final String EXTRA_OUTPUT_4 = "target/other-resources/extra-readme-1.md";
52 public static final String EXTRA_OUTPUT_5 = "target/other-resources/extra-readme-2.md";
53 public static final String EXTRA_OUTPUT_6 = "target/other-resources/other-readme-1.md";
54 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_RESOURCES =
55 "Skipping plugin execution (cached): resources:resources";
56 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_COMPILE =
57 "Skipping plugin execution (cached): compiler:compile";
58 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_TEST_RESOURCES =
59 "Skipping plugin execution (cached): resources:testResources";
60 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_TEST_COMPILE =
61 "Skipping plugin execution (cached): compiler:testCompile";
62 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_SUREFIRE_TEST =
63 "Skipping plugin execution (cached): surefire:test";
64 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_JAR_JAR = "Skipping plugin execution (cached): jar:jar";
65 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_COPY =
66 "Skipping plugin execution (cached): resources:copy-resources";
67 public static final String INSTALL_DEFAULT_INSTALL_MBUILDCACHE_INCREMENTAL =
68 "install (default-install) @ mbuildcache-incremental";
69 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_INSTALL_INSTALL =
70 "Skipping plugin execution (cached): install:install";
71 public static final String DEPLOY_DEFAULT_DEPLOY_MBUILDCACHE_INCREMENTAL =
72 "deploy (default-deploy) @ mbuildcache-incremental";
73 public static final String LOCAL_BUILD_WAS_NOT_FOUND_BY_CHECKSUM = "Local build was not found by checksum";
74 public static final String RESOURCES_DEFAULT_RESOURCES_MBUILDCACHE_INCREMENTAL =
75 "resources (default-resources) @ mbuildcache-incremental";
76 public static final String COMPILE_DEFAULT_COMPILE_MBUILDCACHE_INCREMENTAL =
77 "compile (default-compile) @ mbuildcache-incremental";
78 public static final String TEST_RESOURCES_DEFAULT_TEST_RESOURCES_MBUILDCACHE_INCREMENTAL =
79 "testResources (default-testResources) @ mbuildcache-incremental";
80 public static final String TEST_COMPILE_DEFAULT_TEST_COMPILE_MBUILDCACHE_INCREMENTAL =
81 "testCompile (default-testCompile) @ mbuildcache-incremental";
82 public static final String TEST_DEFAULT_TEST_MBUILDCACHE_INCREMENTAL =
83 "test (default-test) @ mbuildcache-incremental";
84 public static final String JAR_DEFAULT_JAR_MBUILDCACHE_INCREMENTAL = "jar (default-jar) @ mbuildcache-incremental";
85 public static final String
86 FOUND_CACHED_BUILD_RESTORING_ORG_APACHE_MAVEN_CACHING_TEST_MBUILDCACHE_INCREMENTAL_FROM_CACHE_BY_CHECKSUM =
87 "Found cached build, restoring org.apache.maven.caching.test:mbuildcache-incremental from cache by checksum";
88 public static final String MBUILDCACHE_INCREMENTAL_JAR = "mbuildcache-incremental.jar";
89 public static final String MBUILDCACHE_INCREMENTAL_SOURCES_JAR = "mbuildcache-incremental-sources.jar";
90 public static final String MBUILDCACHE_INCREMENTAL_JAVADOC_JAR = "mbuildcache-incremental-javadoc.jar";
91 public static final String INTEGRATION_TEST_DEFAULT_MBUILDCACHE_INCREMENTAL =
92 "integration-test (default) @ mbuildcache-incremental";
93 public static final String VERIFY_DEFAULT_MBUILDCACHE_INCREMENTAL = "verify (default) @ mbuildcache-incremental";
94 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_FAILSAFE_INTEGRATION_TEST =
95 "Skipping plugin execution (cached): failsafe:integration-test";
96 public static final String SKIPPING_PLUGIN_EXECUTION_CACHED_FAILSAFE_VERIFY =
97 "Skipping plugin execution (cached): failsafe:verify";
98
99 @Test
100 void simple(Verifier verifier) throws VerificationException, IOException {
101 verifier.setAutoclean(false);
102 verifier.setMavenDebug(true);
103
104
105 verifier.setLogFileName("../log-package.txt");
106 verifier.executeGoal("package");
107 verifier.verifyErrorFreeLog();
108 verifier.verifyTextInLog(LOCAL_BUILD_WAS_NOT_FOUND_BY_CHECKSUM);
109 verifier.verifyTextInLog(RESOURCES_DEFAULT_RESOURCES_MBUILDCACHE_INCREMENTAL);
110 verifier.verifyTextInLog(COMPILE_DEFAULT_COMPILE_MBUILDCACHE_INCREMENTAL);
111 verifier.verifyTextInLog(TEST_RESOURCES_DEFAULT_TEST_RESOURCES_MBUILDCACHE_INCREMENTAL);
112 verifier.verifyTextInLog(TEST_COMPILE_DEFAULT_TEST_COMPILE_MBUILDCACHE_INCREMENTAL);
113 verifier.verifyTextInLog(TEST_DEFAULT_TEST_MBUILDCACHE_INCREMENTAL);
114 verifier.verifyTextInLog(JAR_DEFAULT_JAR_MBUILDCACHE_INCREMENTAL);
115 verifier.verifyTextInLog(SAVED_BUILD_TO_LOCAL_FILE);
116 verifier.verifyFilePresent(GENERATED_JAR);
117
118
119 verifier.verifyFilePresent(EXTRA_OUTPUT_1);
120 verifier.verifyFilePresent(EXTRA_OUTPUT_2);
121 verifier.verifyFilePresent(EXTRA_OUTPUT_3);
122 verifier.verifyFilePresent(EXTRA_OUTPUT_4);
123 verifier.verifyFilePresent(EXTRA_OUTPUT_5);
124 verifier.verifyFilePresent(EXTRA_OUTPUT_6);
125
126 Path buildInfoPath = getSavedBuildInfoPath(verifier);
127 Path jarCacheFile = buildInfoPath.getParent().resolve(MBUILDCACHE_INCREMENTAL_JAR);
128 Path jarSourcesCacheFile = buildInfoPath.getParent().resolve(MBUILDCACHE_INCREMENTAL_SOURCES_JAR);
129 Path jarJavadocCacheFile = buildInfoPath.getParent().resolve(MBUILDCACHE_INCREMENTAL_JAVADOC_JAR);
130 Assertions.assertTrue(Files.exists(jarCacheFile), "Expected artifact saved in build cache.");
131 Assertions.assertFalse(
132 Files.exists(jarSourcesCacheFile), "Not expected sources artifact saved in build cache.");
133 Assertions.assertFalse(
134 Files.exists(jarJavadocCacheFile), "Not expected javadoc artifact saved in build cache.");
135
136
137 verifier.setMavenDebug(false);
138 verifier.setLogFileName("../log-clean.txt");
139 verifier.executeGoal("clean");
140 verifier.verifyFileNotPresent(GENERATED_JAR);
141
142 verifier.setLogFileName("../log-package-2.txt");
143 verifier.executeGoal("package");
144 verifier.verifyTextInLog(
145 FOUND_CACHED_BUILD_RESTORING_ORG_APACHE_MAVEN_CACHING_TEST_MBUILDCACHE_INCREMENTAL_FROM_CACHE_BY_CHECKSUM);
146 verifier.verifyTextInLog(
147 "Found cached build, restoring org.apache.maven.caching.test:mbuildcache-incremental from cache by checksum");
148 verifier.verifyErrorFreeLog();
149 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_RESOURCES);
150 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_COMPILE);
151 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_TEST_RESOURCES);
152 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_TEST_COMPILE);
153 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_SUREFIRE_TEST);
154 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_JAR_JAR);
155 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_COPY);
156 verifier.verifyFilePresent(GENERATED_JAR);
157
158 verifier.verifyFilePresent(EXTRA_OUTPUT_1);
159 verifier.verifyFilePresent(EXTRA_OUTPUT_2);
160 verifier.verifyFileNotPresent(EXTRA_OUTPUT_3);
161 verifier.verifyFileNotPresent(EXTRA_OUTPUT_4);
162 verifier.verifyFileNotPresent(EXTRA_OUTPUT_5);
163 verifier.verifyFilePresent(EXTRA_OUTPUT_6);
164 Assertions.assertTrue(Files.exists(jarCacheFile), "Expected artifact saved in build cache.");
165
166
167 verifier.setMavenDebug(false);
168 verifier.setLogFileName("../log-clean.txt");
169 verifier.executeGoal("clean");
170 verifier.verifyFileNotPresent(GENERATED_JAR);
171
172 verifier.setLogFileName("../log-verify.txt");
173 verifier.executeGoal("verify");
174 verifier.verifyTextInLog(
175 FOUND_CACHED_BUILD_RESTORING_ORG_APACHE_MAVEN_CACHING_TEST_MBUILDCACHE_INCREMENTAL_FROM_CACHE_BY_CHECKSUM);
176 verifier.verifyTextInLog(
177 "Project org.apache.maven.caching.test:mbuildcache-incremental restored partially. Highest cached goal: package, requested: verify");
178 verifier.verifyErrorFreeLog();
179 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_RESOURCES);
180 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_COMPILE);
181 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_TEST_RESOURCES);
182 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_TEST_COMPILE);
183 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_SUREFIRE_TEST);
184 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_JAR_JAR);
185 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_COPY);
186 verifier.verifyTextInLog(INTEGRATION_TEST_DEFAULT_MBUILDCACHE_INCREMENTAL);
187 verifier.verifyTextInLog(VERIFY_DEFAULT_MBUILDCACHE_INCREMENTAL);
188 verifier.verifyTextInLog(SAVED_BUILD_TO_LOCAL_FILE);
189 verifier.verifyFilePresent(GENERATED_JAR);
190
191 verifier.verifyFilePresent(EXTRA_OUTPUT_1);
192 verifier.verifyFilePresent(EXTRA_OUTPUT_2);
193 verifier.verifyFileNotPresent(EXTRA_OUTPUT_3);
194 verifier.verifyFileNotPresent(EXTRA_OUTPUT_4);
195 verifier.verifyFileNotPresent(EXTRA_OUTPUT_5);
196 verifier.verifyFilePresent(EXTRA_OUTPUT_6);
197 Assertions.assertTrue(Files.exists(jarCacheFile), "Expected artifact saved in build cache.");
198
199
200 verifier.setMavenDebug(false);
201 verifier.setLogFileName("../log-clean.txt");
202 verifier.executeGoal("clean");
203 verifier.verifyFileNotPresent(GENERATED_JAR);
204
205 verifier.setLogFileName("../log-install.txt");
206 verifier.executeGoal("install");
207 verifier.verifyErrorFreeLog();
208 verifier.verifyTextInLog(
209 "Project org.apache.maven.caching.test:mbuildcache-incremental restored partially. Highest cached goal: verify, requested: install");
210 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_RESOURCES);
211 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_COMPILE);
212 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_TEST_RESOURCES);
213 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_TEST_COMPILE);
214 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_SUREFIRE_TEST);
215 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_JAR_JAR);
216 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_COPY);
217 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_FAILSAFE_INTEGRATION_TEST);
218 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_FAILSAFE_VERIFY);
219 verifyNoTextInLog(verifier, RESOURCES_DEFAULT_RESOURCES_MBUILDCACHE_INCREMENTAL);
220 verifyNoTextInLog(verifier, COMPILE_DEFAULT_COMPILE_MBUILDCACHE_INCREMENTAL);
221 verifyNoTextInLog(verifier, TEST_RESOURCES_DEFAULT_TEST_RESOURCES_MBUILDCACHE_INCREMENTAL);
222 verifyNoTextInLog(verifier, TEST_COMPILE_DEFAULT_TEST_COMPILE_MBUILDCACHE_INCREMENTAL);
223 verifyNoTextInLog(verifier, TEST_DEFAULT_TEST_MBUILDCACHE_INCREMENTAL);
224 verifyNoTextInLog(verifier, JAR_DEFAULT_JAR_MBUILDCACHE_INCREMENTAL);
225 verifyNoTextInLog(verifier, INTEGRATION_TEST_DEFAULT_MBUILDCACHE_INCREMENTAL);
226 verifyNoTextInLog(verifier, VERIFY_DEFAULT_MBUILDCACHE_INCREMENTAL);
227 verifier.verifyTextInLog(INSTALL_DEFAULT_INSTALL_MBUILDCACHE_INCREMENTAL);
228 final String installToLocalRepoString =
229 "Installing " + verifier.getBasedir() + File.separatorChar + EXTRA_OUTPUT_1 + " to ";
230 verifier.verifyTextInLog(installToLocalRepoString);
231 verifier.verifyTextInLog(SAVED_BUILD_TO_LOCAL_FILE);
232 verifier.verifyFilePresent(GENERATED_JAR);
233
234 verifier.verifyFilePresent(EXTRA_OUTPUT_1);
235 verifier.verifyFilePresent(EXTRA_OUTPUT_2);
236 verifier.verifyFileNotPresent(EXTRA_OUTPUT_3);
237 verifier.verifyFileNotPresent(EXTRA_OUTPUT_4);
238 verifier.verifyFileNotPresent(EXTRA_OUTPUT_5);
239 verifier.verifyFilePresent(EXTRA_OUTPUT_6);
240 Assertions.assertTrue(Files.exists(jarCacheFile), "Expected artifact saved in build cache.");
241
242
243 verifier.setMavenDebug(false);
244 verifier.setLogFileName("../log-clean.txt");
245 verifier.executeGoal("clean");
246 verifier.verifyFileNotPresent(GENERATED_JAR);
247
248 verifier.setLogFileName("../log-deploy.txt");
249 verifier.executeGoal("deploy");
250 verifier.verifyErrorFreeLog();
251 verifier.verifyTextInLog(
252 "Project org.apache.maven.caching.test:mbuildcache-incremental restored partially. Highest cached goal: install, requested: deploy");
253 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_RESOURCES);
254 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_COMPILE);
255 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_TEST_RESOURCES);
256 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_TEST_COMPILE);
257 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_SUREFIRE_TEST);
258 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_JAR_JAR);
259 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_COPY);
260 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_FAILSAFE_INTEGRATION_TEST);
261 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_FAILSAFE_VERIFY);
262 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_INSTALL_INSTALL);
263 verifyNoTextInLog(verifier, RESOURCES_DEFAULT_RESOURCES_MBUILDCACHE_INCREMENTAL);
264 verifyNoTextInLog(verifier, COMPILE_DEFAULT_COMPILE_MBUILDCACHE_INCREMENTAL);
265 verifyNoTextInLog(verifier, TEST_RESOURCES_DEFAULT_TEST_RESOURCES_MBUILDCACHE_INCREMENTAL);
266 verifyNoTextInLog(verifier, TEST_COMPILE_DEFAULT_TEST_COMPILE_MBUILDCACHE_INCREMENTAL);
267 verifyNoTextInLog(verifier, TEST_DEFAULT_TEST_MBUILDCACHE_INCREMENTAL);
268 verifyNoTextInLog(verifier, JAR_DEFAULT_JAR_MBUILDCACHE_INCREMENTAL);
269 verifyNoTextInLog(verifier, INTEGRATION_TEST_DEFAULT_MBUILDCACHE_INCREMENTAL);
270 verifyNoTextInLog(verifier, VERIFY_DEFAULT_MBUILDCACHE_INCREMENTAL);
271 verifyNoTextInLog(verifier, INSTALL_DEFAULT_INSTALL_MBUILDCACHE_INCREMENTAL);
272 verifier.verifyTextInLog(DEPLOY_DEFAULT_DEPLOY_MBUILDCACHE_INCREMENTAL);
273 verifier.verifyTextInLog("Using alternate deployment repository local::file:./target/staging");
274 verifier.verifyTextInLog(SAVED_BUILD_TO_LOCAL_FILE);
275 verifier.verifyFilePresent(GENERATED_JAR);
276 verifier.verifyFilePresent(GENERATED_SOURCES_JAR);
277 verifier.verifyFilePresent(GENERATED_JAVADOC_JAR);
278
279 verifier.verifyFilePresent(EXTRA_OUTPUT_1);
280 verifier.verifyFilePresent(EXTRA_OUTPUT_2);
281 verifier.verifyFileNotPresent(EXTRA_OUTPUT_3);
282 verifier.verifyFileNotPresent(EXTRA_OUTPUT_4);
283 verifier.verifyFileNotPresent(EXTRA_OUTPUT_5);
284 verifier.verifyFilePresent(EXTRA_OUTPUT_6);
285 Assertions.assertTrue(Files.exists(jarCacheFile), "Expected artifact saved in build cache.");
286 Assertions.assertTrue(Files.exists(jarSourcesCacheFile), "Expected sources artifact saved in build cache.");
287 Assertions.assertTrue(Files.exists(jarJavadocCacheFile), "Expected javadoc artifact saved in build cache.");
288
289
290 verifier.setLogFileName("../log-install-replay.txt");
291 verifier.executeGoal("install");
292 verifier.verifyErrorFreeLog();
293 verifier.verifyTextInLog(
294 FOUND_CACHED_BUILD_RESTORING_ORG_APACHE_MAVEN_CACHING_TEST_MBUILDCACHE_INCREMENTAL_FROM_CACHE_BY_CHECKSUM);
295 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_RESOURCES);
296 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_COMPILE);
297 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_TEST_RESOURCES);
298 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_COMPILER_TEST_COMPILE);
299 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_SUREFIRE_TEST);
300 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_JAR_JAR);
301 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_RESOURCES_COPY);
302 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_FAILSAFE_INTEGRATION_TEST);
303 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_FAILSAFE_VERIFY);
304 verifier.verifyTextInLog(SKIPPING_PLUGIN_EXECUTION_CACHED_INSTALL_INSTALL);
305 verifyNoTextInLog(verifier, DEPLOY_DEFAULT_DEPLOY_MBUILDCACHE_INCREMENTAL);
306 verifyNoTextInLog(verifier, RESOURCES_DEFAULT_RESOURCES_MBUILDCACHE_INCREMENTAL);
307 verifyNoTextInLog(verifier, COMPILE_DEFAULT_COMPILE_MBUILDCACHE_INCREMENTAL);
308 verifyNoTextInLog(verifier, TEST_RESOURCES_DEFAULT_TEST_RESOURCES_MBUILDCACHE_INCREMENTAL);
309 verifyNoTextInLog(verifier, TEST_COMPILE_DEFAULT_TEST_COMPILE_MBUILDCACHE_INCREMENTAL);
310 verifyNoTextInLog(verifier, TEST_DEFAULT_TEST_MBUILDCACHE_INCREMENTAL);
311 verifyNoTextInLog(verifier, JAR_DEFAULT_JAR_MBUILDCACHE_INCREMENTAL);
312 verifyNoTextInLog(verifier, INTEGRATION_TEST_DEFAULT_MBUILDCACHE_INCREMENTAL);
313 verifyNoTextInLog(verifier, VERIFY_DEFAULT_MBUILDCACHE_INCREMENTAL);
314 verifyNoTextInLog(verifier, INSTALL_DEFAULT_INSTALL_MBUILDCACHE_INCREMENTAL);
315 verifyNoTextInLog(verifier, installToLocalRepoString);
316 verifyNoTextInLog(verifier, SAVED_BUILD_TO_LOCAL_FILE, "Expected successful build cache restore.");
317 verifier.verifyFilePresent(GENERATED_JAR);
318 verifier.verifyFilePresent(GENERATED_SOURCES_JAR);
319 verifier.verifyFilePresent(GENERATED_JAVADOC_JAR);
320
321 verifier.verifyFilePresent(EXTRA_OUTPUT_1);
322 verifier.verifyFilePresent(EXTRA_OUTPUT_2);
323 verifier.verifyFileNotPresent(EXTRA_OUTPUT_3);
324 verifier.verifyFileNotPresent(EXTRA_OUTPUT_4);
325 verifier.verifyFileNotPresent(EXTRA_OUTPUT_5);
326 verifier.verifyFilePresent(EXTRA_OUTPUT_6);
327 Assertions.assertTrue(Files.exists(jarCacheFile), "Expected artifact saved in build cache.");
328 Assertions.assertTrue(Files.exists(jarSourcesCacheFile), "Expected sources artifact saved in build cache.");
329 Assertions.assertTrue(Files.exists(jarJavadocCacheFile), "Expected javadoc artifact saved in build cache.");
330 }
331
332 private static void verifyNoTextInLog(Verifier verifier, String text, String message) throws VerificationException {
333 Assertions.assertNull(findFirstLineContainingTextsInLogs(verifier, text), message);
334 }
335
336 private static void verifyNoTextInLog(Verifier verifier, String text) throws VerificationException {
337 Assertions.assertNull(findFirstLineContainingTextsInLogs(verifier, text));
338 }
339
340 private static Path getSavedBuildInfoPath(Verifier verifier) throws VerificationException {
341 String savedPathLogLine = findFirstLineContainingTextsInLogs(verifier, SAVED_BUILD_TO_LOCAL_FILE);
342 String[] array = savedPathLogLine.split(SAVED_BUILD_TO_LOCAL_FILE);
343 return Paths.get(array[array.length - 1]);
344 }
345 }