Skip to content

Commit 1e6d5ad

Browse files
committed
fix: corrected tests
1 parent ffa49cf commit 1e6d5ad

File tree

5 files changed

+80
-7
lines changed

5 files changed

+80
-7
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
REDIS_URL='redis://localhost:6379'
22
ENVIRONMENT='development'
3-
MODE='dynamic'
3+
MODE='static'
44
RUNTIME_TOKEN="<token>"
5-
FLOW_FALLBACK_PATH='../flow/test_flow_one.json'
5+
FLOW_FALLBACK_PATH='./flow/test_flow_one.json'

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ edition = "2024"
55

66
[dependencies]
77
tokio = { version = "1.44.1", features = ["rt-multi-thread"] }
8-
dotenv = "0.15.0"
98
futures = "0.3.31"
109
log = "0.4.26"
1110
env_logger = "0.11.8"

src/flow/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ mod test {
112112
};
113113

114114
let id = get_flow_identifier(&rest);
115-
assert_eq!(id, String::from("1::1::REST::abc.code0.tech::GET"))
115+
assert_eq!(id, String::from("1.1.REST.abc.code0.tech.GET"))
116116
}
117117

118118
#[test]

src/main.rs

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ use prost::Message;
55
use sagittarius::flow_service_client_impl::SagittariusFlowClient;
66
use serde_json::from_str;
77
use server::AquilaGRPCServer;
8-
use std::{fs::File, io::Read, sync::Arc};
9-
use tucana::shared::Flows;
8+
use std::{collections::HashMap, fs::File, io::Read, sync::Arc};
9+
use tucana::shared::{
10+
FlowSetting, Flows, NodeFunction, NodeParameter, NodeValue, Struct, ValidationFlow, Value,
11+
node_value, value::Kind,
12+
};
1013

1114
pub mod authorization;
1215
pub mod configuration;
@@ -17,6 +20,77 @@ pub mod stream;
1720

1821
#[tokio::main]
1922
async fn main() {
23+
let flow = ValidationFlow {
24+
flow_id: 1,
25+
project_id: 1,
26+
r#type: String::from("REST"),
27+
data_types: vec![],
28+
input_type_identifier: Some(String::from("HTTP_REQUEST")),
29+
return_type_identifier: Some(String::from("HTTP_RESPONSE")),
30+
settings: vec![
31+
FlowSetting {
32+
database_id: 1,
33+
flow_setting_id: String::from("HTTP_METHOD"),
34+
object: Some(Struct {
35+
fields: HashMap::from([(
36+
String::from("method"),
37+
Value {
38+
kind: Some(Kind::StringValue(String::from("GET"))),
39+
},
40+
)]),
41+
}),
42+
},
43+
FlowSetting {
44+
database_id: 1,
45+
flow_setting_id: String::from("HTTP_URL"),
46+
object: Some(Struct {
47+
fields: HashMap::from([(
48+
String::from("url"),
49+
Value {
50+
kind: Some(Kind::StringValue(String::from("/hello-world"))),
51+
},
52+
)]),
53+
}),
54+
},
55+
FlowSetting {
56+
database_id: 1,
57+
flow_setting_id: String::from("HTTP_HOST"),
58+
object: Some(Struct {
59+
fields: HashMap::from([(
60+
String::from("host"),
61+
Value {
62+
kind: Some(Kind::StringValue(String::from("localhost"))),
63+
},
64+
)]),
65+
}),
66+
},
67+
],
68+
starting_node: Some(NodeFunction {
69+
database_id: 1,
70+
runtime_function_id: String::from("std::control::break"),
71+
next_node: None,
72+
parameters: vec![NodeParameter {
73+
database_id: 1,
74+
runtime_parameter_id: String::from("value"),
75+
value: Some(NodeValue {
76+
value: Some(node_value::Value::LiteralValue(Value {
77+
kind: Some(Kind::StructValue(Struct {
78+
fields: HashMap::from([(
79+
String::from("hallo"),
80+
Value {
81+
kind: Some(Kind::StringValue(String::from("welt"))),
82+
},
83+
)]),
84+
})),
85+
})),
86+
}),
87+
}],
88+
}),
89+
};
90+
91+
let s = serde_json::to_string_pretty(&flow).unwrap();
92+
println!("{}", s);
93+
2094
log::info!("Starting Aquila...");
2195

2296
// Configure Logging
@@ -106,6 +180,7 @@ async fn init_flows_from_json(
106180
for flow in flows.flows {
107181
let key = get_flow_identifier(&flow);
108182
let bytes = flow.encode_to_vec();
183+
log::info!("Inserting flow with key {}", &key);
109184
match flow_store_client.put(key, bytes.into()).await {
110185
Ok(_) => log::info!("Flow updated successfully"),
111186
Err(err) => log::error!("Failed to update flow. Reason: {:?}", err),

0 commit comments

Comments
 (0)