Fix mock tests
This commit is contained in:
34
.idea/compiler.xml
generated
34
.idea/compiler.xml
generated
@@ -8,11 +8,43 @@
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
</profile>
|
||||
<profile name="Annotation profile for Troostwijk Auction Scraper" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath useClasspath="false">
|
||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.40/lombok-1.18.40.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/io/quarkus/quarkus-extension-processor/3.17.7/quarkus-extension-processor-3.17.7.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/jboss/jdeparser/jdeparser/2.0.3.Final/jdeparser-2.0.3.Final.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/jsoup/jsoup/1.15.3/jsoup-1.15.3.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/github/javaparser/javaparser-core/3.26.2/javaparser-core-3.26.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.18.2/jackson-databind-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.18.2/jackson-annotations-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.18.2/jackson-core-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.18.2/jackson-dataformat-yaml-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/yaml/snakeyaml/2.3/snakeyaml-2.3.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-parameter-names/2.18.2/jackson-module-parameter-names-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/io/quarkus/quarkus-bootstrap-app-model/3.17.7/quarkus-bootstrap-app-model-3.17.7.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.40/lombok-1.18.40.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/io/quarkus/quarkus-extension-processor/3.17.7/quarkus-extension-processor-3.17.7.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/jboss/jdeparser/jdeparser/2.0.3.Final/jdeparser-2.0.3.Final.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/jsoup/jsoup/1.15.3/jsoup-1.15.3.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/github/javaparser/javaparser-core/3.26.2/javaparser-core-3.26.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.18.2/jackson-databind-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.18.2/jackson-annotations-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.18.2/jackson-core-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.18.2/jackson-dataformat-yaml-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/org/yaml/snakeyaml/2.3/snakeyaml-2.3.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-parameter-names/2.18.2/jackson-module-parameter-names-2.18.2.jar" />
|
||||
<entry name="$MAVEN_REPOSITORY$/io/quarkus/quarkus-bootstrap-app-model/3.17.7/quarkus-bootstrap-app-model-3.17.7.jar" />
|
||||
</processorPath>
|
||||
<module name="auctiora" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="auctiora" options="-Xdiags:verbose -Xlint:all -proc:none" />
|
||||
<module name="auctiora" options="-Xdiags:verbose -Xlint:all -parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
56
pom.xml
56
pom.xml
@@ -215,6 +215,59 @@
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-scheduler</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Force Netty 4.1.124.Final to avoid sun.misc.Unsafe warnings -->
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-common</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-handler</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-buffer</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-codec</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-codec-http</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-codec-http2</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-resolver</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-resolver-dns</artifactId>
|
||||
<version>4.1.124.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
@@ -279,6 +332,7 @@
|
||||
<properties>
|
||||
<build.timestamp>${maven.build.timestamp}</build.timestamp>
|
||||
</properties>
|
||||
<jvmArgs>--enable-native-access=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true</jvmArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -316,7 +370,7 @@
|
||||
<compilerArgs>
|
||||
<arg>-Xdiags:verbose</arg>
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-proc:none</arg>
|
||||
<arg>-parameters</arg>
|
||||
</compilerArgs>
|
||||
<fork>true</fork>
|
||||
<excludes>
|
||||
|
||||
@@ -33,16 +33,16 @@ public class Main {
|
||||
log.info("=== Troostwijk Auction Monitor ===\n");
|
||||
|
||||
// Parse command line arguments
|
||||
String mode = args.length > 0 ? args[0] : "workflow";
|
||||
var mode = args.length > 0 ? args[0] : "workflow";
|
||||
|
||||
// Configuration - Windows paths
|
||||
String databaseFile = System.getenv().getOrDefault("DATABASE_FILE", "C:\\mnt\\okcomputer\\output\\cache.db");
|
||||
String notificationConfig = System.getenv().getOrDefault("NOTIFICATION_CONFIG", "desktop");
|
||||
var databaseFile = System.getenv().getOrDefault("DATABASE_FILE", "C:\\mnt\\okcomputer\\output\\cache.db");
|
||||
var notificationConfig = System.getenv().getOrDefault("NOTIFICATION_CONFIG", "desktop");
|
||||
|
||||
// YOLO model paths (optional - monitor works without object detection)
|
||||
String yoloCfg = "models/yolov4.cfg";
|
||||
String yoloWeights = "models/yolov4.weights";
|
||||
String yoloClasses = "models/coco.names";
|
||||
var yoloCfg = "models/yolov4.cfg";
|
||||
var yoloWeights = "models/yolov4.weights";
|
||||
var yoloClasses = "models/coco.names";
|
||||
|
||||
// Load native OpenCV library (only if models exist)
|
||||
try {
|
||||
@@ -85,7 +85,7 @@ public class Main {
|
||||
|
||||
log.info("🚀 Starting in WORKFLOW MODE (Orchestrated Scheduling)\n");
|
||||
|
||||
WorkflowOrchestrator orchestrator = new WorkflowOrchestrator(
|
||||
var orchestrator = new WorkflowOrchestrator(
|
||||
dbPath, notifConfig, yoloCfg, yoloWeights, yoloClasses
|
||||
);
|
||||
|
||||
@@ -127,7 +127,7 @@ public class Main {
|
||||
|
||||
log.info("🔄 Starting in ONCE MODE (Single Execution)\n");
|
||||
|
||||
WorkflowOrchestrator orchestrator = new WorkflowOrchestrator(
|
||||
var orchestrator = new WorkflowOrchestrator(
|
||||
dbPath, notifConfig, yoloCfg, yoloWeights, yoloClasses
|
||||
);
|
||||
|
||||
@@ -179,7 +179,7 @@ public class Main {
|
||||
|
||||
log.info("📊 Checking Status...\n");
|
||||
|
||||
WorkflowOrchestrator orchestrator = new WorkflowOrchestrator(
|
||||
var orchestrator = new WorkflowOrchestrator(
|
||||
dbPath, notifConfig, yoloCfg, yoloWeights, yoloClasses
|
||||
);
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ public class ObjectDetectionService {
|
||||
if (!Files.exists(cfgFile) || !Files.exists(weightsFile) || !Files.exists(classNamesFile)) {
|
||||
log.info("⚠️ Object detection disabled: YOLO model files not found");
|
||||
log.info(" Expected files:");
|
||||
log.info(" - " + cfgPath);
|
||||
log.info(" - " + weightsPath);
|
||||
log.info(" - " + classNamesPath);
|
||||
log.info(" - {}", cfgPath);
|
||||
log.info(" - {}", weightsPath);
|
||||
log.info(" - {}", classNamesPath);
|
||||
log.info(" Scraper will continue without image analysis.");
|
||||
this.enabled = false;
|
||||
this.net = null;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class QuarkusWorkflowScheduler {
|
||||
void importScraperData() {
|
||||
try {
|
||||
LOG.info("📥 [WORKFLOW 1] Importing scraper data...");
|
||||
long start = System.currentTimeMillis();
|
||||
var start = System.currentTimeMillis();
|
||||
|
||||
// Import auctions
|
||||
var auctions = db.importAuctionsFromScraper();
|
||||
@@ -58,7 +58,7 @@ public class QuarkusWorkflowScheduler {
|
||||
var images = db.getUnprocessedImagesFromScraper();
|
||||
LOG.infof(" → Found %d unprocessed images", images.size());
|
||||
|
||||
long duration = System.currentTimeMillis() - start;
|
||||
var duration = System.currentTimeMillis() - start;
|
||||
LOG.infof(" ✓ Scraper import completed in %dms", duration);
|
||||
|
||||
// Trigger notification if significant data imported
|
||||
@@ -84,7 +84,7 @@ public class QuarkusWorkflowScheduler {
|
||||
void processImages() {
|
||||
try {
|
||||
LOG.info("🖼️ [WORKFLOW 2] Processing pending images...");
|
||||
long start = System.currentTimeMillis();
|
||||
var start = System.currentTimeMillis();
|
||||
|
||||
// Get unprocessed images
|
||||
var unprocessedImages = db.getUnprocessedImagesFromScraper();
|
||||
@@ -96,13 +96,13 @@ public class QuarkusWorkflowScheduler {
|
||||
|
||||
LOG.infof(" → Processing %d images", unprocessedImages.size());
|
||||
|
||||
int processed = 0;
|
||||
int detected = 0;
|
||||
var processed = 0;
|
||||
var detected = 0;
|
||||
|
||||
for (var imageRecord : unprocessedImages) {
|
||||
try {
|
||||
// Download image
|
||||
String filePath = imageProcessor.downloadImage(
|
||||
var filePath = imageProcessor.downloadImage(
|
||||
imageRecord.url(),
|
||||
imageRecord.saleId(),
|
||||
imageRecord.lotId()
|
||||
@@ -141,7 +141,7 @@ public class QuarkusWorkflowScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
long duration = System.currentTimeMillis() - start;
|
||||
var duration = System.currentTimeMillis() - start;
|
||||
LOG.infof(" ✓ Processed %d images, detected objects in %d (%.1fs)",
|
||||
processed, detected, duration / 1000.0);
|
||||
|
||||
@@ -159,7 +159,7 @@ public class QuarkusWorkflowScheduler {
|
||||
void monitorBids() {
|
||||
try {
|
||||
LOG.info("💰 [WORKFLOW 3] Monitoring bids...");
|
||||
long start = System.currentTimeMillis();
|
||||
var start = System.currentTimeMillis();
|
||||
|
||||
var activeLots = db.getActiveLots();
|
||||
LOG.infof(" → Checking %d active lots", activeLots.size());
|
||||
@@ -168,7 +168,7 @@ public class QuarkusWorkflowScheduler {
|
||||
// For now, we just track what's in the database
|
||||
// The external scraper updates bids, we just notify
|
||||
|
||||
long duration = System.currentTimeMillis() - start;
|
||||
var duration = System.currentTimeMillis() - start;
|
||||
LOG.infof(" ✓ Bid monitoring completed in %dms", duration);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -185,19 +185,19 @@ public class QuarkusWorkflowScheduler {
|
||||
void checkClosingTimes() {
|
||||
try {
|
||||
LOG.info("⏰ [WORKFLOW 4] Checking closing times...");
|
||||
long start = System.currentTimeMillis();
|
||||
var start = System.currentTimeMillis();
|
||||
|
||||
var activeLots = db.getActiveLots();
|
||||
int alertsSent = 0;
|
||||
var alertsSent = 0;
|
||||
|
||||
for (var lot : activeLots) {
|
||||
if (lot.closingTime() == null) continue;
|
||||
|
||||
long minutesLeft = lot.minutesUntilClose();
|
||||
var minutesLeft = lot.minutesUntilClose();
|
||||
|
||||
// Alert for lots closing in 5 minutes
|
||||
if (minutesLeft <= 5 && minutesLeft > 0 && !lot.closingNotified()) {
|
||||
String message = String.format("Kavel %d sluit binnen %d min.",
|
||||
var message = String.format("Kavel %d sluit binnen %d min.",
|
||||
lot.lotId(), minutesLeft);
|
||||
|
||||
notifier.sendNotification(message, "Lot Closing Soon", 1);
|
||||
@@ -215,7 +215,7 @@ public class QuarkusWorkflowScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
long duration = System.currentTimeMillis() - start;
|
||||
var duration = System.currentTimeMillis() - start;
|
||||
LOG.infof(" → Sent %d closing alerts in %dms", alertsSent, duration);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class RateLimitedHttpClient {
|
||||
* Sends a GET request with automatic rate limiting based on host.
|
||||
*/
|
||||
public HttpResponse<String> sendGet(String url) throws IOException, InterruptedException {
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
var request = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url))
|
||||
.timeout(Duration.ofSeconds(timeoutSeconds))
|
||||
.GET()
|
||||
@@ -70,7 +70,7 @@ public class RateLimitedHttpClient {
|
||||
* Sends a request for binary data (like images) with rate limiting.
|
||||
*/
|
||||
public HttpResponse<byte[]> sendGetBytes(String url) throws IOException, InterruptedException {
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
var request = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url))
|
||||
.timeout(Duration.ofSeconds(timeoutSeconds))
|
||||
.GET()
|
||||
@@ -85,21 +85,21 @@ public class RateLimitedHttpClient {
|
||||
public <T> HttpResponse<T> send(HttpRequest request, HttpResponse.BodyHandler<T> bodyHandler)
|
||||
throws IOException, InterruptedException {
|
||||
|
||||
String host = extractHost(request.uri());
|
||||
RateLimiter limiter = getRateLimiter(host);
|
||||
RequestStats stats = getRequestStats(host);
|
||||
var host = extractHost(request.uri());
|
||||
var limiter = getRateLimiter(host);
|
||||
var stats = getRequestStats(host);
|
||||
|
||||
// Enforce rate limit (blocks if necessary)
|
||||
limiter.acquire();
|
||||
|
||||
// Track request
|
||||
stats.incrementTotal();
|
||||
long startTime = System.currentTimeMillis();
|
||||
var startTime = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
HttpResponse<T> response = httpClient.send(request, bodyHandler);
|
||||
var response = httpClient.send(request, bodyHandler);
|
||||
|
||||
long duration = System.currentTimeMillis() - startTime;
|
||||
var duration = System.currentTimeMillis() - startTime;
|
||||
stats.recordSuccess(duration);
|
||||
|
||||
LOG.debugf("HTTP %d %s %s (%dms)",
|
||||
@@ -125,7 +125,7 @@ public class RateLimitedHttpClient {
|
||||
*/
|
||||
private RateLimiter getRateLimiter(String host) {
|
||||
return rateLimiters.computeIfAbsent(host, h -> {
|
||||
int maxRps = getMaxRequestsPerSecond(h);
|
||||
var maxRps = getMaxRequestsPerSecond(h);
|
||||
LOG.infof("Initializing rate limiter for %s: %d req/s", h, maxRps);
|
||||
return new RateLimiter(maxRps);
|
||||
});
|
||||
@@ -174,6 +174,7 @@ public class RateLimitedHttpClient {
|
||||
* Allows burst traffic up to maxRequestsPerSecond, then enforces steady rate.
|
||||
*/
|
||||
private static class RateLimiter {
|
||||
|
||||
private final Semaphore semaphore;
|
||||
private final int maxRequestsPerSecond;
|
||||
private final long intervalNanos;
|
||||
@@ -191,18 +192,18 @@ public class RateLimitedHttpClient {
|
||||
semaphore.acquire();
|
||||
|
||||
// Enforce minimum delay between requests
|
||||
long delayMillis = intervalNanos / 1_000_000;
|
||||
var delayMillis = intervalNanos / 1_000_000;
|
||||
if (delayMillis > 0) {
|
||||
Thread.sleep(delayMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private void startRefillThread() {
|
||||
Thread refillThread = new Thread(() -> {
|
||||
var refillThread = new Thread(() -> {
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
Thread.sleep(1000); // Refill every second
|
||||
int toRelease = maxRequestsPerSecond - semaphore.availablePermits();
|
||||
var toRelease = maxRequestsPerSecond - semaphore.availablePermits();
|
||||
if (toRelease > 0) {
|
||||
semaphore.release(toRelease);
|
||||
}
|
||||
@@ -221,6 +222,7 @@ public class RateLimitedHttpClient {
|
||||
* Statistics tracker for HTTP requests per host.
|
||||
*/
|
||||
public static class RequestStats {
|
||||
|
||||
private final String host;
|
||||
private final AtomicLong totalRequests = new AtomicLong(0);
|
||||
private final AtomicLong successfulRequests = new AtomicLong(0);
|
||||
@@ -256,7 +258,7 @@ public class RateLimitedHttpClient {
|
||||
public long getFailedRequests() { return failedRequests.get(); }
|
||||
public long getRateLimitedRequests() { return rateLimitedRequests.get(); }
|
||||
public long getAverageDurationMs() {
|
||||
long successful = successfulRequests.get();
|
||||
var successful = successfulRequests.get();
|
||||
return successful > 0 ? totalDurationMs.get() / successful : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,19 +19,19 @@ public class ScraperDataAdapter {
|
||||
|
||||
static AuctionInfo fromScraperAuction(ResultSet rs) throws SQLException {
|
||||
// Parse "A7-39813" → auctionId=39813, type="A7"
|
||||
String auctionIdStr = rs.getString("auction_id");
|
||||
int auctionId = extractNumericId(auctionIdStr);
|
||||
String type = extractTypePrefix(auctionIdStr);
|
||||
var auctionIdStr = rs.getString("auction_id");
|
||||
var auctionId = extractNumericId(auctionIdStr);
|
||||
var type = extractTypePrefix(auctionIdStr);
|
||||
|
||||
// Split "Cluj-Napoca, RO" → city="Cluj-Napoca", country="RO"
|
||||
String location = rs.getString("location");
|
||||
String[] locationParts = parseLocation(location);
|
||||
String city = locationParts[0];
|
||||
String country = locationParts[1];
|
||||
var location = rs.getString("location");
|
||||
var locationParts = parseLocation(location);
|
||||
var city = locationParts[0];
|
||||
var country = locationParts[1];
|
||||
|
||||
// Map field names
|
||||
int lotCount = getIntOrDefault(rs, "lots_count", 0);
|
||||
LocalDateTime closingTime = parseTimestamp(getStringOrNull(rs, "first_lot_closing_time"));
|
||||
var lotCount = getIntOrDefault(rs, "lots_count", 0);
|
||||
var closingTime = parseTimestamp(getStringOrNull(rs, "first_lot_closing_time"));
|
||||
|
||||
return new AuctionInfo(
|
||||
auctionId,
|
||||
|
||||
@@ -94,18 +94,18 @@ public class WorkflowOrchestrator {
|
||||
|
||||
// Import auctions
|
||||
var auctions = db.importAuctionsFromScraper();
|
||||
log.info(" → Imported " + auctions.size() + " auctions");
|
||||
log.info(" → Imported {} auctions", auctions.size());
|
||||
|
||||
// Import lots
|
||||
var lots = db.importLotsFromScraper();
|
||||
log.info(" → Imported " + lots.size() + " lots");
|
||||
log.info(" → Imported {} lots", lots.size());
|
||||
|
||||
// Import image URLs
|
||||
var images = db.getUnprocessedImagesFromScraper();
|
||||
log.info(" → Found " + images.size() + " unprocessed images");
|
||||
log.info(" → Found {} unprocessed images", images.size());
|
||||
|
||||
long duration = System.currentTimeMillis() - start;
|
||||
log.info(" ✓ Scraper import completed in " + duration + "ms\n");
|
||||
log.info(" ✓ Scraper import completed in {}ms\n", duration);
|
||||
|
||||
// Trigger notification if significant data imported
|
||||
if (auctions.size() > 0 || lots.size() > 10) {
|
||||
@@ -117,7 +117,7 @@ public class WorkflowOrchestrator {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(" ❌ Scraper import failed: " + e.getMessage());
|
||||
log.info(" ❌ Scraper import failed: {}", e.getMessage());
|
||||
}
|
||||
}, 0, 30, TimeUnit.MINUTES);
|
||||
|
||||
@@ -143,7 +143,7 @@ public class WorkflowOrchestrator {
|
||||
return;
|
||||
}
|
||||
|
||||
log.info(" → Processing " + unprocessedImages.size() + " images");
|
||||
log.info(" → Processing {} images", unprocessedImages.size());
|
||||
|
||||
int processed = 0;
|
||||
int detected = 0;
|
||||
@@ -186,7 +186,7 @@ public class WorkflowOrchestrator {
|
||||
Thread.sleep(500);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(" ⚠️ Failed to process image: " + e.getMessage());
|
||||
log.info(" ⚠\uFE0F Failed to process image: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public class WorkflowOrchestrator {
|
||||
processed, detected, duration / 1000.0));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(" ❌ Image processing failed: " + e.getMessage());
|
||||
log.info(" ❌ Image processing failed: {}", e.getMessage());
|
||||
}
|
||||
}, 5, 60, TimeUnit.MINUTES);
|
||||
|
||||
@@ -214,7 +214,7 @@ public class WorkflowOrchestrator {
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
var activeLots = db.getActiveLots();
|
||||
log.info(" → Checking " + activeLots.size() + " active lots");
|
||||
log.info(" → Checking {} active lots", activeLots.size());
|
||||
|
||||
int bidChanges = 0;
|
||||
|
||||
@@ -228,7 +228,7 @@ public class WorkflowOrchestrator {
|
||||
log.info(String.format(" ✓ Bid monitoring completed in %dms\n", duration));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(" ❌ Bid monitoring failed: " + e.getMessage());
|
||||
log.info(" ❌ Bid monitoring failed: {}", e.getMessage());
|
||||
}
|
||||
}, 2, 15, TimeUnit.MINUTES);
|
||||
|
||||
@@ -279,7 +279,7 @@ public class WorkflowOrchestrator {
|
||||
alertsSent, duration));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(" ❌ Closing alerts failed: " + e.getMessage());
|
||||
log.info(" ❌ Closing alerts failed: {}", e.getMessage());
|
||||
}
|
||||
}, 1, 5, TimeUnit.MINUTES);
|
||||
|
||||
@@ -298,7 +298,7 @@ public class WorkflowOrchestrator {
|
||||
log.info("[1/4] Importing scraper data...");
|
||||
var auctions = db.importAuctionsFromScraper();
|
||||
var lots = db.importLotsFromScraper();
|
||||
log.info(" ✓ Imported " + auctions.size() + " auctions, " + lots.size() + " lots");
|
||||
log.info(" ✓ Imported {} auctions, {} lots", auctions.size(), lots.size());
|
||||
|
||||
// Step 2: Process images
|
||||
log.info("[2/4] Processing pending images...");
|
||||
@@ -308,7 +308,7 @@ public class WorkflowOrchestrator {
|
||||
// Step 3: Check bids
|
||||
log.info("[3/4] Monitoring bids...");
|
||||
var activeLots = db.getActiveLots();
|
||||
log.info(" ✓ Monitored " + activeLots.size() + " lots");
|
||||
log.info(" ✓ Monitored {} lots", activeLots.size());
|
||||
|
||||
// Step 4: Check closing times
|
||||
log.info("[4/4] Checking closing times...");
|
||||
@@ -318,12 +318,12 @@ public class WorkflowOrchestrator {
|
||||
closingSoon++;
|
||||
}
|
||||
}
|
||||
log.info(" ✓ Found " + closingSoon + " lots closing soon");
|
||||
log.info(" ✓ Found {} lots closing soon", closingSoon);
|
||||
|
||||
log.info("\n✓ Complete workflow finished successfully\n");
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("\n❌ Workflow failed: " + e.getMessage() + "\n");
|
||||
log.info("\n❌ Workflow failed: {}\n", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ public class WorkflowOrchestrator {
|
||||
* Event-driven trigger: New auction discovered
|
||||
*/
|
||||
public void onNewAuctionDiscovered(AuctionInfo auction) {
|
||||
log.info("📣 EVENT: New auction discovered - " + auction.title());
|
||||
log.info("\uD83D\uDCE3 EVENT: New auction discovered - {}", auction.title());
|
||||
|
||||
try {
|
||||
db.upsertAuction(auction);
|
||||
@@ -344,7 +344,7 @@ public class WorkflowOrchestrator {
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(" ❌ Failed to handle new auction: " + e.getMessage());
|
||||
log.info(" ❌ Failed to handle new auction: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ public class WorkflowOrchestrator {
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(" ❌ Failed to handle bid change: " + e.getMessage());
|
||||
log.info(" ❌ Failed to handle bid change: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ public class WorkflowOrchestrator {
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info(" ❌ Failed to send detection notification: " + e.getMessage());
|
||||
log.info(" ❌ Failed to send detection notification: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,16 +395,16 @@ public class WorkflowOrchestrator {
|
||||
*/
|
||||
public void printStatus() {
|
||||
log.info("\n📊 Workflow Status:");
|
||||
log.info(" Running: " + (isRunning ? "Yes" : "No"));
|
||||
log.info(" Running: {}", isRunning ? "Yes" : "No");
|
||||
|
||||
try {
|
||||
var auctions = db.getAllAuctions();
|
||||
var lots = db.getAllLots();
|
||||
int images = db.getImageCount();
|
||||
|
||||
log.info(" Auctions: " + auctions.size());
|
||||
log.info(" Lots: " + lots.size());
|
||||
log.info(" Images: " + images);
|
||||
log.info(" Auctions: {}", auctions.size());
|
||||
log.info(" Lots: {}", lots.size());
|
||||
log.info(" Images: {}", images);
|
||||
|
||||
// Count closing soon
|
||||
int closingSoon = 0;
|
||||
@@ -413,10 +413,10 @@ public class WorkflowOrchestrator {
|
||||
closingSoon++;
|
||||
}
|
||||
}
|
||||
log.info(" Closing soon (< 30 min): " + closingSoon);
|
||||
log.info(" Closing soon (< 30 min): {}", closingSoon);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(" ⚠️ Could not retrieve status: " + e.getMessage());
|
||||
log.info(" ⚠\uFE0F Could not retrieve status: {}", e.getMessage());
|
||||
}
|
||||
|
||||
IO.println();
|
||||
|
||||
@@ -33,7 +33,6 @@ quarkus.log.console.level=INFO
|
||||
|
||||
# JVM Arguments for native access (Jansi, OpenCV, etc.)
|
||||
quarkus.native.additional-build-args=--enable-native-access=ALL-UNNAMED
|
||||
quarkus.jvm.args=--enable-native-access=ALL-UNNAMED
|
||||
|
||||
# Production optimizations
|
||||
%prod.quarkus.package.type=fast-jar
|
||||
|
||||
Reference in New Issue
Block a user