wForget edited a comment on issue #1063:
URL: 
https://github.com/apache/incubator-linkis/issues/1063#issuecomment-958988873


   ## Test
   
   ### 1. In linkis-engineplugin-shell, add the `TestOperator` to implement the 
`Operator` interface:
   
   ```
   class TestOperator extends Operator {
     override def getName: String = "test"
   
     var properties: Map[String, Any] = Map()
   
     override def apply(): EngineOperateResponse = {
       EngineOperateResponse(properties)
     }
   
     override def init(properties: Map[String, Any]): Unit = {
       this.properties = properties
     }
   }
   ```
   
   ### 2. Client test:
   
   ```
     val serverUrl = "http://testip:9001";
     val username = "test"
     val password = "test"
     // Suggest to use LinkisJobClient to submit job to Linkis.
     val clientConfig = 
DWSClientConfigBuilder.newBuilder().addServerUrl(serverUrl)
       .connectionTimeout(30000).discoveryEnabled(true)
       .discoveryFrequency(1, TimeUnit.MINUTES)
       .loadbalancerEnabled(true).maxConnectionSize(5)
       .retryEnabled(false).readTimeout(30000)
       .setAuthenticationStrategy(new StaticAuthenticationStrategy())
       .setAuthTokenKey(username)
       .setAuthTokenValue(password).setDWSVersion("v1").build()
   
     val client = UJESClient(clientConfig)
   
     val managerClient = LinkisManagerClient(client)
   
     val engineConnInstance = "engineconnIp:11635"
     val engineOperateAction = EngineOperateAction.newBuilder()
       .operatorName("test")
       .addProperty("test", "111")
       .setUser(username)
       .setApplicationName("linkis-cg-engineconn")
       .setInstance(engineConnInstance)
       .build()
   
     val result = managerClient.executeEngineOperation(engineOperateAction)
   
     println(result.getResult)
   ```
   
   output:
   
   ```
   {test=111, __operator_name__=test}
   ```


-- 
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: dev-unsubscr...@linkis.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@linkis.apache.org
For additional commands, e-mail: dev-h...@linkis.apache.org

Reply via email to