You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "suyanhanx (via GitHub)" <gi...@apache.org> on 2023/03/31 01:30:56 UTC

[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #1809: feat(bindings/java): add cucumber test case for memory

suyanhanx commented on code in PR #1809:
URL: https://github.com/apache/incubator-opendal/pull/1809#discussion_r1153927644


##########
bindings/java/src/lib.rs:
##########
@@ -38,10 +38,21 @@ pub extern "system" fn Java_org_apache_opendal_Operator_getOperator(
         .get_string(&input)
         .expect("Couldn't get java string!")
         .into();
+
     let schema = Scheme::from_str(&input).unwrap();

Review Comment:
   ```suggestion
        let scheme = Scheme::from_str(&input).unwrap();
   ```
   



##########
bindings/java/src/test/java/org/apache/opendal/StepsTest.java:
##########
@@ -0,0 +1,58 @@
+package org.apache.opendal;
+
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class StepsTest {
+
+    Operator operator;
+
+    @Given("A new OpenDAL Blocking Operator")
+    public void a_new_open_dal_blocking_operator() {
+        Map<String, String> params = new HashMap<>();
+        params.put("root", "/tmp");
+        this.operator = new Operator("Memory", params);
+    }
+
+    @When("Blocking write path \"test\" with content \"Hello, World!\"")
+    public void blocking_write_path_test_with_content_hello_world() {
+        this.operator.write("test", "Hello, World!");
+    }
+
+
+    @Then("The blocking file \"test\" should exist")
+    public void the_blocking_file_test_should_exist() {
+
+    }
+
+
+    @Then("The blocking file \"test\" entry mode must be file")
+    public void the_blocking_file_test_entry_mode_must_be_file() {
+        // Write code here that turns the phrase above into concrete actions
+//        throw new io.cucumber.java.PendingException();
+    }
+
+    @Then("The blocking file \"test\" content length must be 13")
+    public void the_blocking_file_test_content_length_must_be_13() {
+        // Write code here that turns the phrase above into concrete actions
+        String content = this.operator.read("test");

Review Comment:
   We should use the var which is injected.
   
   https://cucumber.io/docs/cucumber/step-definitions/?lang=java



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org