FuYouJ commented on PR #4841:
URL: https://github.com/apache/seatunnel/pull/4841#issuecomment-1584524741

   > please add e2e testcase check this change 
https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-neo4j-e2e
   
   I have added additional tests, please review.
   ```json
   env {
     # You can set engine configuration here
     execution.parallelism = 1
     job.mode = "BATCH"
     checkpoint.interval = 5000
     #execution.checkpoint.data-uri = "hdfs://localhost:9000/checkpoint"
   }
   
   source {
     # This is a example source plugin **only for test and demonstrate the 
feature source plugin**
     FakeSource {
       result_table_name = "fake"
       parallelism = 1
       schema = {
         fields {
           name = "string"
           age = "int"
         }
       }
     }
   }
   
   transform {
   }
   
   sink {
     Neo4j {
       uri = "neo4j://neo4j-host:7687"
       username = "neo4j"
       password = "Test@12343"
       database = "neo4j"
       batch_data_variable = "ttt"
       max_batch_size = 3
       write_mode = "Batch"
   
       max_transaction_retry_time = 3
       max_connection_timeout = 1
   
       query = "unwind $ttt as row  create(n:BatchLabel) set n.name = 
row.name,n.age = row.age"
     }
   }
   ```
   and this is e2e test code
   ```java
   public void testBatchWrite(TestContainer container) throws IOException, 
InterruptedException {
           // clean test data before test
           final Result checkExists = neo4jSession.run("MATCH (n:BatchLabel) 
RETURN n limit 1");
           if (checkExists.hasNext()) {
               neo4jSession.run("MATCH (n:BatchLabel) delete n");
           }
   
           // unwind $ttt as row create(n:BatchLabel) set n.name = 
row.name,n.age = row.age
           Container.ExecResult execResult =
                   
container.executeJob("/neo4j/fake_to_neo4j_batch_write.conf");
           // then
           Assertions.assertEquals(0, execResult.getExitCode());
           final Result result = neo4jSession.run("MATCH (n:BatchLabel) RETURN 
n");
           // nodes
           assertTrue(result.hasNext());
           // verify the attributes of the node
           result.stream()
                   .forEach(
                           r -> {
                               String name = r.get("n").get("name").asString();
                               assertNotNull(name);
                               Object age = r.get("n").get("age").asObject();
                               assertNotNull(age);
                           });
       }
   ```


-- 
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