atharvalade commented on code in PR #3096:
URL: https://github.com/apache/iggy/pull/3096#discussion_r3190976509


##########
core/integration/tests/cli/context/test_context_show_command.rs:
##########
@@ -0,0 +1,274 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use std::collections::BTreeMap;
+
+use crate::cli::common::{
+    CLAP_INDENT, IggyCmdCommand, IggyCmdTest, IggyCmdTestCase, TestHelpCmd, 
USAGE_PREFIX,
+};
+use assert_cmd::assert::Assert;
+use async_trait::async_trait;
+use iggy::prelude::Client;
+use iggy_cli::commands::binary_context::common::ContextConfig;
+use iggy_common::ArgsOptional;
+use predicates::str::contains;
+use serial_test::parallel;
+
+use super::common::TestIggyContext;
+
+struct TestContextShowCmd {
+    test_iggy_context: TestIggyContext,
+    context_to_show: String,
+    expected_fields: Vec<(String, String)>,
+}
+
+impl TestContextShowCmd {
+    fn new(
+        test_iggy_context: TestIggyContext,
+        context_to_show: String,
+        expected_fields: Vec<(String, String)>,
+    ) -> Self {
+        Self {
+            test_iggy_context,
+            context_to_show,
+            expected_fields,
+        }
+    }
+}
+
+#[async_trait]
+impl IggyCmdTestCase for TestContextShowCmd {
+    async fn prepare_server_state(&mut self, _client: &dyn Client) {
+        self.test_iggy_context.prepare().await;
+    }
+
+    fn get_command(&self) -> IggyCmdCommand {
+        IggyCmdCommand::new()
+            .env(
+                "IGGY_HOME",
+                self.test_iggy_context.get_iggy_home().to_str().unwrap(),
+            )
+            .arg("context")
+            .arg("show")
+            .arg(self.context_to_show.clone())
+            .with_env_credentials()
+    }
+
+    fn verify_command(&self, command_state: Assert) {
+        let mut command_state = command_state.success();
+
+        for (key, value) in &self.expected_fields {
+            command_state = command_state
+                .stdout(contains(key.as_str()))
+                .stdout(contains(value.as_str()));
+        }

Review Comment:
   changed to combined row substrings 



##########
core/cli/src/commands/binary_system/session_status.rs:
##########
@@ -0,0 +1,70 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use crate::commands::binary_system::session::ServerSession;
+use crate::commands::cli_command::{CliCommand, PRINT_TARGET};
+use async_trait::async_trait;
+use comfy_table::Table;
+use iggy_common::Client;
+use tracing::{Level, event};
+
+pub struct SessionStatusCmd {
+    server_session: ServerSession,
+}
+
+impl SessionStatusCmd {
+    pub fn new(server_address: String) -> Self {
+        Self {
+            server_session: ServerSession::new(server_address),
+        }
+    }
+}
+
+#[async_trait]
+impl CliCommand for SessionStatusCmd {
+    fn explain(&self) -> String {
+        "session status command".to_owned()
+    }
+
+    fn login_required(&self) -> bool {
+        false
+    }
+
+    fn connection_required(&self) -> bool {
+        false
+    }
+
+    async fn execute_cmd(&mut self, _client: &dyn Client) -> 
anyhow::Result<(), anyhow::Error> {
+        let is_active = self.server_session.is_active();
+        let server_address = self.server_session.get_server_address();
+
+        let mut table = Table::new();
+        table.set_header(vec!["Property", "Value"]);
+        table.add_row(vec!["Server Address", server_address]);
+
+        if is_active {
+            table.add_row(vec!["Session Active", "Yes"]);
+        } else {
+            table.add_row(vec!["Session Active", "No"]);
+        }

Review Comment:
   collapsed 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to