Skip to content

Commit

Permalink
Use Conts file for some constant values
Browse files Browse the repository at this point in the history
  • Loading branch information
thamindumk committed Jan 13, 2025
1 parent 92b12f1 commit 7051494
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/frontend/JasmineGraphFrontEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,14 +1279,14 @@ static void add_stream_kafka_command(int connFd, std::string &kafka_server_IP, c
*loop_exit_p = true;
return;
}
result_wr = write(connFd, "\r\n", 2);
result_wr = write(connFd, Conts::CARRIAGE_RETURN_NEW_LINE.c_str(), Conts::CARRIAGE_RETURN_NEW_LINE.size());
if (result_wr < 0) {
frontend_logger.error("Error writing to socket");
*loop_exit_p = true;
return;

Check warning on line 1286 in src/frontend/JasmineGraphFrontEnd.cpp

View check run for this annotation

Codecov / codecov/patch

src/frontend/JasmineGraphFrontEnd.cpp#L1285-L1286

Added lines #L1285 - L1286 were not covered by tests
}
string msg_2 = "Is this graph Directed (y/n)? ";
result_wr = write(connFd, msg_2.c_str(), msg_2.length());
string checkDirection = "Is this graph Directed (y/n)? ";
result_wr = write(connFd, checkDirection.c_str(), checkDirection.length());
if (result_wr < 0) {
frontend_logger.error("Error writing to socket");
*loop_exit_p = true;
Expand All @@ -1303,20 +1303,20 @@ static void add_stream_kafka_command(int connFd, std::string &kafka_server_IP, c
}
string direction;

Check warning on line 1304 in src/frontend/JasmineGraphFrontEnd.cpp

View check run for this annotation

Codecov / codecov/patch

src/frontend/JasmineGraphFrontEnd.cpp#L1304

Added line #L1304 was not covered by tests
if (is_directed == "y") {
direction = "1";
direction = Conts::DIRECTED;
} else {
direction = "0";
direction = Conts::UNDIRECTED;
}

string msg_3 = "Graph type received";
result_wr = write(connFd, msg_3.c_str(), msg_3.length());
string checkGraphType = "Graph type received";
result_wr = write(connFd, checkGraphType.c_str(), checkGraphType.length());
if (result_wr < 0) {
frontend_logger.error("Error writing to socket");
*loop_exit_p = true;
return;

Check warning on line 1316 in src/frontend/JasmineGraphFrontEnd.cpp

View check run for this annotation

Codecov / codecov/patch

src/frontend/JasmineGraphFrontEnd.cpp#L1315-L1316

Added lines #L1315 - L1316 were not covered by tests
}

result_wr = write(connFd, "\r\n", 2);
result_wr = write(connFd, Conts::CARRIAGE_RETURN_NEW_LINE.c_str(), Conts::CARRIAGE_RETURN_NEW_LINE.size());
if (result_wr < 0) {
frontend_logger.error("Error writing to socket");
*loop_exit_p = true;
Expand Down
3 changes: 2 additions & 1 deletion src/util/Conts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ limitations under the License.

std::string Conts::JASMINEGRAPH_EXECUTABLE = "run.sh";
std::string Conts::JASMINEGRAPH_HOME = "JASMINEGRAPH_HOME";

std::string Conts::DIRECTED = "1";
std::string Conts::UNDIRECTED = "0";
std::string Conts::CARRIAGE_RETURN_NEW_LINE = "\r\n";

std::string Conts::GRAPH_TYPE_RDF = "RDF_GRAPH";
Expand Down
3 changes: 2 additions & 1 deletion src/util/Conts.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class Conts {
static std::string GRAPH_WITH_TEXT_ATTRIBUTES;
static std::string GRAPH_WITH_JSON_ATTRIBUTES;
static std::string GRAPH_WITH_XML_ATTRIBUTES;

static std::string DIRECTED;
static std::string UNDIRECTED;
static std::string CARRIAGE_RETURN_NEW_LINE;

static std::string
Expand Down

0 comments on commit 7051494

Please sign in to comment.