Skip to content

Commit

Permalink
Service Call JSON now display the proper Kafka Filter Header path and…
Browse files Browse the repository at this point in the history
… value #2465

Fixed #2465
  • Loading branch information
vertigo17 committed Aug 5, 2023
1 parent ea3e8ee commit f1e6318
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public TestCaseExecution executeTestCase(TestCaseExecution execution) throws Cer

// Open Kafka Consumer
execution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_LOADINGKAFKACONSUMERS));
updateExecutionWebSocketOnly(execution, true);
updateExecution(execution, true);
execution.setKafkaLatestOffset(kafkaService.getAllConsumers(mainExecutionTestCaseStepList, execution));

// Initialize the global TestCaseExecution Data List
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,36 @@ public class RunTestCaseService implements IRunTestCaseService {
private static final Logger LOG = LogManager.getLogger(RunTestCaseService.class);

@Override
public TestCaseExecution runTestCase(TestCaseExecution tCExecution) {
public TestCaseExecution runTestCase(TestCaseExecution execution) {

// Start Execution (Checks and Creation of ID)
try {
LOG.debug("Start Execution " + "ID={}", tCExecution.getId());
tCExecution = executionStartService.startExecution(tCExecution);
LOG.info("Execution Started : UUID={} ID= {}", tCExecution.getExecutionUUID(), " ID=" + tCExecution.getId());
LOG.debug("Start Execution " + "ID={}", execution.getId());
execution = executionStartService.startExecution(execution);
LOG.info("Execution Started : UUID={} ID= {}", execution.getExecutionUUID(), " ID=" + execution.getId());

} catch (CerberusException ex) {
tCExecution.setResultMessage(ex.getMessageError());
LOG.info("Execution not Launched : UUID={} causedBy={}", tCExecution.getExecutionUUID(), ex.getMessageError().getDescription());
execution.setResultMessage(ex.getMessageError());
LOG.info("Execution not Launched : UUID={} causedBy={}", execution.getExecutionUUID(), ex.getMessageError().getDescription());
try {
// After every execution finished we try to trigger more from the queue;-).
executionThreadPoolService.executeNextInQueueAsynchroneously(false);
} catch (CerberusException ex1) {
LOG.error(ex1.toString(), ex1);
}
return tCExecution;
return execution;
}

// Execute TestCase in new thread if the execution is asynchronous
if (tCExecution.getId() != 0) {
if (execution.getId() != 0) {
try {
if (!tCExecution.isSynchroneous()) {
executionRunService.executeTestCaseAsynchronously(tCExecution);
if (!execution.isSynchroneous()) {
executionRunService.executeTestCaseAsynchronously(execution);
} else {
tCExecution = executionRunService.executeTestCase(tCExecution);
execution = executionRunService.executeTestCase(execution);
}
} catch (CerberusException ex) {
tCExecution.setResultMessage(ex.getMessageError());
execution.setResultMessage(ex.getMessageError());
LOG.warn("Execution stopped due to exception. {}", ex.getMessageError().getDescription(), ex);
try {
// After every execution finished we try to trigger more from the queue;-).
Expand All @@ -88,8 +88,8 @@ public TestCaseExecution runTestCase(TestCaseExecution tCExecution) {
LOG.error(ex1.toString(), ex1);
}
} catch (Exception ex) {
tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.GENERIC_ERROR));
LOG.warn("Execution stopped due to exception : UUID={} causeBy={}", tCExecution.getExecutionUUID(), ex.toString(), ex);
execution.setResultMessage(new MessageGeneral(MessageGeneralEnum.GENERIC_ERROR));
LOG.warn("Execution stopped due to exception : UUID={} causeBy={}", execution.getExecutionUUID(), ex.toString(), ex);
try {
// After every execution finished we try to trigger more from the queue;-).
executionThreadPoolService.executeNextInQueueAsynchroneously(false);
Expand All @@ -99,7 +99,7 @@ public TestCaseExecution runTestCase(TestCaseExecution tCExecution) {
}
}

LOG.debug("Exit RunTestCaseService : {}", tCExecution.getId());
return tCExecution;
LOG.debug("Exit RunTestCaseService : {}", execution.getId());
return execution;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ public AnswerItem<AppService> callService(String service, String targetNbEvents,
appService.setKafkaResponseOffset(-1);
appService.setKafkaFilterPath(decodedFilterPath);
appService.setKafkaFilterValue(decodedFilterValue);
appService.setKafkaFilterHeaderPath(decodedFilterHeaderPath);
appService.setKafkaFilterHeaderValue(decodedFilterHeaderValue);

String kafkaKey = kafkaService.getKafkaConsumerKey(decodedTopic, decodedServicePath);
AnswerItem<String> resultSearch = kafkaService.searchEvent(tCExecution.getKafkaLatestOffset().get(kafkaKey), decodedTopic, decodedServicePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,46 +256,6 @@ public AnswerItem<AppService> produceEvent(String topic, String key, String even

if (activateAvro) {

// String userSchema = "{"
// + " \"name\": \"ProductGenericEvent\","
// + " \"type\": \"record\","
// + " \"namespace\": \"fr.adeo.redwood.event.avro.product\","
// + " \"fields\": ["
// + " {"
// + " \"name\": \"id\","
// + " \"type\": \"string\""
// + " },"
// + " {"
// + " \"name\": \"timestamp\","
// + " \"type\": \"long\""
// + " },"
// + " {"
// + " \"name\": \"eventType\","
// + " \"type\": \"string\""
// + " },"
// + " {"
// + " \"name\": \"productReferenceAdeo\","
// + " \"type\": \"int\""
// + " },"
// + " {"
// + " \"name\": \"productReferenceBU\","
// + " \"type\": \"int\""
//// + " \"type\": [\"int\",\"null\"],"
//// + " \"default\":null"
// + " },"
// + " {"
// + " \"name\": \"codeBU\","
// + " \"type\": \"string\""
// + " },"
// + " {"
// + " \"name\": \"source\","
// + " \"type\": \"string\""
// + " }"
// + " ]"
// + "}";
//
// LOG.debug("userSchema");
// LOG.debug(userSchema);
Schema.Parser parser = new Schema.Parser();
Schema schemaValue;
Schema schemaKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Fixed wrong status on manual test execution. #2455
* Fixed impossibility to delete all property with the same name. #2454
* Fixed the Job that CANCELLED execution queue entries so that it does not not consider the timeout from the time it was inserted to the queue but the time when the execution was triggered. #2472
* Service Call JSON now display the proper Kafka Filter Header path and value #2465

*Improvements / New features*
[square]
Expand Down

0 comments on commit f1e6318

Please sign in to comment.