Skip to content
Snippets Groups Projects
Commit d69c2467 authored by George Sedov's avatar George Sedov
Browse files

Remove windows test for kafka, update kafka message for full path

parent 5f68dc1c
No related branches found
No related tags found
No related merge requests found
#include "request_handler_kafka_notify.h"
#include "../request.h"
#include "file_processors/file_processor.h"
namespace asapo {
......@@ -9,9 +10,15 @@ Error RequestHandlerKafkaNotify::ProcessRequest(Request* request) const {
return nullptr;
}
std::string root_folder;
if (auto err = GetRootFolder(request, &root_folder)){
return err;
}
std::string message = "{"
"\"event\":\"IN_CLOSE_WRITE\","
"\"path\":\"" + request->GetFileName() + "\""
"\"path\":\"" + root_folder + kPathSeparator + request->GetFileName() + "\""
"}";
return kafka_client_->Send(message, "asapo");
......
set(TARGET_NAME transfer-single-file_kafka)
set(SOURCE_FILES kafka_mock.cpp)
if (NOT WIN32)
set(SOURCE_FILES kafka_mock.cpp)
add_executable(${TARGET_NAME} ${SOURCE_FILES})
target_link_libraries(${TARGET_NAME} rdkafka)
add_executable(${TARGET_NAME} ${SOURCE_FILES})
target_link_libraries(${TARGET_NAME} rdkafka)
#use expression generator to get rid of VS adding Debug/Release folders
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}$<$<CONFIG:Debug>:>
)
#use expression generator to get rid of VS adding Debug/Release folders
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}$<$<CONFIG:Debug>:>
)
################################
# Testing
################################
prepare_asapo()
################################
# Testing
################################
prepare_asapo()
add_script_test("${TARGET_NAME}" "$<TARGET_FILE:dummy-data-producer>" nomem)
add_script_test("${TARGET_NAME}" "$<TARGET_FILE:dummy-data-producer>" nomem)
endif()
\ No newline at end of file
......@@ -32,7 +32,7 @@ Cleanup() {
rm -f bootstrap
./transfer-single-file_kafka processed/1 & KAFKA_PID=$!
./transfer-single-file_kafka ${receiver_folder}/processed/1 & KAFKA_PID=$!
echo "Started the kafka listener"
......
SET mongo_exe="c:\Program Files\MongoDB\Server\4.2\bin\mongo.exe"
SET beamtime_id=asapo_test
SET beamline=test
SET receiver_root_folder=c:\tmp\asapo\receiver\files
SET receiver_folder="%receiver_root_folder%\test_facility\gpfs\%beamline%\2019\data\%beamtime_id%"
mkdir %receiver_folder%
"%1" 127.0.0.1:8400 %beamtime_id% 100 1 1 0 30
ping 192.0.2.1 -n 1 -w 1000 > nul
FOR /F "usebackq" %%A IN ('%receiver_folder%\processed\1') DO set size=%%~zA
if %size% NEQ 100000 goto :error
"%1" 127.0.0.1:8400 wrong_id 100 1 1 0 2 2>1 | findstr /c:"authorization" || goto :error
goto :clean
:error
call :clean
exit /b 1
:clean
rmdir /S /Q %receiver_root_folder%
echo db.dropDatabase() | %mongo_exe% %beamtime_id%_detector
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment