|
26 | 26 | import java.util.Arrays; |
27 | 27 | import java.util.Collection; |
28 | 28 | import java.util.Properties; |
29 | | -import java.util.logging.Logger; |
30 | 29 |
|
31 | 30 | import static org.apache.commons.codec.binary.Base64.encodeBase64; |
32 | 31 | import static org.apache.commons.lang3.StringUtils.isEmpty; |
@@ -56,7 +55,6 @@ public abstract class ArtifactoryTestsBase { |
56 | 55 | protected VirtualRepository virtualRepository; |
57 | 56 | protected RemoteRepository remoteRepository; |
58 | 57 | protected String federationUrl; |
59 | | - private static final Logger logger = Logger.getLogger(ArtifactoryTestsBase.class.getName()); |
60 | 58 |
|
61 | 59 | @BeforeClass |
62 | 60 | public void init() throws IOException { |
@@ -213,31 +211,23 @@ protected String textFrom(InputStream is) throws IOException { |
213 | 211 | protected void deleteRepoWithRetry(String repoKey) { |
214 | 212 | for (int attempt = 1; attempt <= 3; attempt++) { |
215 | 213 | try { |
216 | | - logger.info("Attempt " + attempt + " to delete repo: " + repoKey); |
217 | 214 | deleteRepoIfExists(repoKey); |
218 | | - logger.info("Successfully deleted repo: " + repoKey + " on attempt " + attempt); |
219 | 215 | return; |
220 | 216 | } catch (RuntimeException e) { |
221 | 217 | Throwable cause = e.getCause(); |
222 | | - logger.warning("Attempt " + attempt + " failed to delete repo: " + repoKey + ". Reason: " + e.getMessage()); |
223 | 218 | if (cause instanceof HttpResponseException && |
224 | 219 | ((HttpResponseException) cause).getStatusCode() == 500 && |
225 | 220 | cause.getMessage() != null && cause.getMessage().contains("Lock on LockEntryId")) { |
226 | 221 |
|
227 | 222 | if (attempt < 3) { |
228 | | - logger.info("Lock detected. Retrying after 5 seconds..."); |
229 | 223 | try { |
230 | 224 | Thread.sleep(5000); |
231 | 225 | } catch (InterruptedException ie) { |
232 | 226 | Thread.currentThread().interrupt(); |
233 | | - logger.warning("Retry interrupted while waiting to retry repo deletion: " + repoKey); |
234 | 227 | return; |
235 | 228 | } |
236 | | - } else { |
237 | | - logger.severe("Failed to delete repo after 3 attempts due to lock: " + repoKey); |
238 | 229 | } |
239 | 230 | } else { |
240 | | - logger.severe("Non-lock error occurred. Not retrying. Repo: " + repoKey); |
241 | 231 | return; // Non-lock error, don't retry |
242 | 232 | } |
243 | 233 | } |
|
0 commit comments