[GitHub] [skywalking] arugal commented on a change in pull request #3788: Rabbitmq plugin test migration

2019-11-09 Thread GitBox
arugal commented on a change in pull request #3788: Rabbitmq plugin test 
migration
URL: https://github.com/apache/skywalking/pull/3788#discussion_r344469631
 
 

 ##
 File path: test/plugin/scenarios/rabbitmq-scenario/pom.xml
 ##
 @@ -0,0 +1,131 @@
+
+
+
+http://maven.apache.org/POM/4.0.0;
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
+4.0.0
+
+org.apache.skywalking
+rabbitmq-scenario
+5.0.0-2018
+skywalking-rabbitmq-scenario
+
+
+UTF-8
+
+5.4.0
+${test.framework.version}
+
+2.8.1
+2.1.4.RELEASE
+
+
+
+
+com.rabbitmq
+amqp-client
+${test.framework.version}
+
+
+
+org.springframework.boot
+spring-boot-starter
+${spring-boot-version}
+
+
+spring-boot-starter-logging
+org.springframework.boot
+
+
+
+
+org.apache.logging.log4j
+log4j-api
+${log4j.version}
+
+
+org.apache.logging.log4j
+log4j-core
+${log4j.version}
+
+
+org.springframework.boot
+spring-boot-starter-web
+${spring-boot-version}
+
+
+
+
+rabbitmq-scenario
+
+
+org.springframework.boot
+spring-boot-maven-plugin
+1.5.9.RELEASE
+
+
+
+repackage
+
+
+
+
+
+org.apache.maven.plugins
+maven-compiler-plugin
+3.6.0
+
+1.8
+1.8
+${project.build.sourceEncoding}
+
+
+
+org.apache.maven.plugins
+maven-assembly-plugin
+
+
+assemble
+package
+
+single
+
+
+
+
src/main/assembly/assembly.xml
+
+
+
+
+
+
+
+
+
+
+spring-snapshots
+http://repo.spring.io/snapshot
+
+
+spring-milestones
+http://repo.spring.io/milestone
+
+
 
 Review comment:
   missing


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [skywalking] arugal commented on a change in pull request #3788: Rabbitmq plugin test migration

2019-11-09 Thread GitBox
arugal commented on a change in pull request #3788: Rabbitmq plugin test 
migration
URL: https://github.com/apache/skywalking/pull/3788#discussion_r344469718
 
 

 ##
 File path: 
test/plugin/scenarios/rabbitmq-scenario/src/main/java/org/apache/skywalking/apm/testcase/rabbitmq/controller/CaseController.java
 ##
 @@ -0,0 +1,135 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.rabbitmq.controller;
+
+
+import com.rabbitmq.client.*;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+
+import java.io.IOException;
+
+@RestController
+@RequestMapping("/case")
+@PropertySource("classpath:application.properties")
+public class CaseController {
+
+private Logger logger = LogManager.getLogger(CaseController.class);
+
+
+private static final String USERNAME = "admin";
+
+private static final String PASSWORD = "admin";
+
+@Value(value = "${rabbitmq.host:127.0.0.1}")
+private String brokerUrl;
+
+private static final int PORT = 5672;
+
+private static final  String QUEUE_NAME = "test";
+
+private static final  String MESSAGE = "rabbitmq-testcase";
+
+ConnectionFactory factory;
+
+Connection connection = null;
+
+
+@RequestMapping("/rabbitmq")
+@ResponseBody
+public String rabbitmqCase() throws Exception {
+Channel channel = null;
+
+try{
+factory = new ConnectionFactory();
+logger.info("Using brokerUrl = " + brokerUrl);
+factory.setHost(brokerUrl);
+factory.setPort(PORT);
+factory.setUsername(USERNAME);
+factory.setPassword(PASSWORD);
+
+connection = factory.newConnection();
+
+channel = connection.createChannel();
+channel.queueDeclare(QUEUE_NAME, false, false, false, null);
+AMQP.BasicProperties.Builder propsBuilder = new 
AMQP.BasicProperties.Builder();
+logger.info("Message being published -->"+MESSAGE);
+channel.basicPublish("", QUEUE_NAME, propsBuilder.build(), 
MESSAGE.getBytes("UTF-8"));
+logger.info("Message has been published-->"+MESSAGE);
+
+DeliverCallback deliverCallback = (consumerTag, delivery) -> {
+String message = new String(delivery.getBody(), "UTF-8");
+logger.info("Message received-->"+message);
+};
+channel.basicConsume(QUEUE_NAME, true, deliverCallback, 
consumerTag -> { });
+Thread.sleep(5000);
+logger.info("Message Consumed-->");
+
+}catch (Exception ex){
+logger.error(ex.toString());
+}
+finally {
+if (channel != null) {
+channel.close();
+}
+if (connection != null) {
+connection.close();
+}
 
 Review comment:
   ```java
   if(channel != null){
   try {
   channel.close();
   }catch (Exception e){
   // ignore
   }
   }
   if(connection != null){
   try {
   connection.close();
   }catch (Exception e){
   // ignore
   }
   }
   ```
   It should look like this?


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [skywalking] arugal commented on a change in pull request #3788: Rabbitmq plugin test migration

2019-11-09 Thread GitBox
arugal commented on a change in pull request #3788: Rabbitmq plugin test 
migration
URL: https://github.com/apache/skywalking/pull/3788#discussion_r344469966
 
 

 ##
 File path: 
test/plugin/scenarios/rabbitmq-scenario/src/main/java/org/apache/skywalking/apm/testcase/rabbitmq/controller/CaseController.java
 ##
 @@ -0,0 +1,135 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.rabbitmq.controller;
+
+
+import com.rabbitmq.client.*;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+
+import java.io.IOException;
+
+@RestController
+@RequestMapping("/case")
+@PropertySource("classpath:application.properties")
+public class CaseController {
+
+private Logger logger = LogManager.getLogger(CaseController.class);
+
+
+private static final String USERNAME = "admin";
+
+private static final String PASSWORD = "admin";
+
+@Value(value = "${rabbitmq.host:127.0.0.1}")
+private String brokerUrl;
+
+private static final int PORT = 5672;
+
+private static final  String QUEUE_NAME = "test";
+
+private static final  String MESSAGE = "rabbitmq-testcase";
+
+ConnectionFactory factory;
+
+Connection connection = null;
+
+
+@RequestMapping("/rabbitmq")
+@ResponseBody
+public String rabbitmqCase() throws Exception {
+Channel channel = null;
+
+try{
+factory = new ConnectionFactory();
+logger.info("Using brokerUrl = " + brokerUrl);
+factory.setHost(brokerUrl);
+factory.setPort(PORT);
+factory.setUsername(USERNAME);
+factory.setPassword(PASSWORD);
+
+connection = factory.newConnection();
+
+channel = connection.createChannel();
+channel.queueDeclare(QUEUE_NAME, false, false, false, null);
+AMQP.BasicProperties.Builder propsBuilder = new 
AMQP.BasicProperties.Builder();
+logger.info("Message being published -->"+MESSAGE);
+channel.basicPublish("", QUEUE_NAME, propsBuilder.build(), 
MESSAGE.getBytes("UTF-8"));
+logger.info("Message has been published-->"+MESSAGE);
+
+DeliverCallback deliverCallback = (consumerTag, delivery) -> {
+String message = new String(delivery.getBody(), "UTF-8");
+logger.info("Message received-->"+message);
+};
+channel.basicConsume(QUEUE_NAME, true, deliverCallback, 
consumerTag -> { });
+Thread.sleep(5000);
 
 Review comment:
   Please remove the ```sleep 5000```.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [skywalking] arugal commented on a change in pull request #3788: Rabbitmq plugin test migration

2019-11-09 Thread GitBox
arugal commented on a change in pull request #3788: Rabbitmq plugin test 
migration
URL: https://github.com/apache/skywalking/pull/3788#discussion_r344469617
 
 

 ##
 File path: 
test/plugin/scenarios/rabbitmq-scenario/src/main/java/org/apache/skywalking/apm/testcase/rabbitmq/controller/CaseController.java
 ##
 @@ -0,0 +1,135 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.rabbitmq.controller;
+
+
+import com.rabbitmq.client.*;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+
+import java.io.IOException;
+
+@RestController
+@RequestMapping("/case")
+@PropertySource("classpath:application.properties")
+public class CaseController {
+
+private Logger logger = LogManager.getLogger(CaseController.class);
+
+
+private static final String USERNAME = "admin";
+
+private static final String PASSWORD = "admin";
+
+@Value(value = "${rabbitmq.host:127.0.0.1}")
+private String brokerUrl;
+
+private static final int PORT = 5672;
+
+private static final  String QUEUE_NAME = "test";
+
+private static final  String MESSAGE = "rabbitmq-testcase";
+
+ConnectionFactory factory;
+
+Connection connection = null;
+
 
 Review comment:
   ```factory态connection``` should be a local variable.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [skywalking] arugal commented on a change in pull request #3788: Rabbitmq plugin test migration

2019-11-09 Thread GitBox
arugal commented on a change in pull request #3788: Rabbitmq plugin test 
migration
URL: https://github.com/apache/skywalking/pull/3788#discussion_r344469820
 
 

 ##
 File path: 
test/plugin/scenarios/rabbitmq-scenario/src/main/resources/log4j2.xml
 ##
 @@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
 
 Review comment:
   The log level is recommended to be changed to ```WARN```


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [skywalking] arugal commented on a change in pull request #3788: Rabbitmq plugin test migration

2019-11-07 Thread GitBox
arugal commented on a change in pull request #3788: Rabbitmq plugin test 
migration
URL: https://github.com/apache/skywalking/pull/3788#discussion_r343972646
 
 

 ##
 File path: test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml
 ##
 @@ -0,0 +1,100 @@
+# 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.
+registryItems:
+  applications:
+  - {rabbitmq-scenario: nq 0}
+  instances:
+  - {rabbitmq-scenario: 1}
+  operationNames:
+  - rabbitmq-scenario: 
[/rabbitmq-scenario/case/rabbitmq,/rabbitmq-scenario/case/healthcheck,RabbitMQ/Topic/Queue/test/Producer,RabbitMQ/Topic/Queue/test/Consumer]
+segmentItems:
+- applicationCode: rabbitmq-scenario
+  segmentSize: ge 2
+  segments:
 
 Review comment:
   Should be changed to ```gt 2``` or ```ge 3```


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [skywalking] arugal commented on a change in pull request #3788: Rabbitmq plugin test migration

2019-11-07 Thread GitBox
arugal commented on a change in pull request #3788: Rabbitmq plugin test 
migration
URL: https://github.com/apache/skywalking/pull/3788#discussion_r343971873
 
 

 ##
 File path: test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml
 ##
 @@ -0,0 +1,100 @@
+# 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.
+registryItems:
+  applications:
+  - {rabbitmq-scenario: nq 0}
+  instances:
+  - {rabbitmq-scenario: 1}
+  operationNames:
+  - rabbitmq-scenario: 
[/rabbitmq-scenario/case/rabbitmq,/rabbitmq-scenario/case/healthcheck,RabbitMQ/Topic/Queue/test/Producer,RabbitMQ/Topic/Queue/test/Consumer]
 
 Review comment:
   Don't need healthcheck operation name


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [skywalking] arugal commented on a change in pull request #3788: Rabbitmq plugin test migration

2019-11-07 Thread GitBox
arugal commented on a change in pull request #3788: Rabbitmq plugin test 
migration
URL: https://github.com/apache/skywalking/pull/3788#discussion_r343971635
 
 

 ##
 File path: test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml
 ##
 @@ -0,0 +1,100 @@
+# 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.
+registryItems:
+  applications:
+  - {rabbitmq-scenario: nq 0}
+  instances:
+  - {rabbitmq-scenario: 1}
+  operationNames:
+  - rabbitmq-scenario: 
[/rabbitmq-scenario/case/rabbitmq,/rabbitmq-scenario/case/healthcheck,RabbitMQ/Topic/Queue/test/Producer,RabbitMQ/Topic/Queue/test/Consumer]
+segmentItems:
+- applicationCode: rabbitmq-scenario
+  segmentSize: ge 2
+  segments:
+  - segmentId: not null
+spans:
+- operationName: RabbitMQ/Topic/Queue/test/Consumer
+  operationId: 0
+  parentSpanId: -1
+  spanId: 0
+  spanLayer: MQ
+  startTime: nq 0
+  endTime: nq 0
+  componentId: 53
+  componentName: ''
+  isError: false
+  spanType: Entry
+  peer: ''
+  peerId: 0
+  tags:
+  - {key: mq.broker, value: 'not null'}
+  - {key: mq.topic, value: ''}
+  - {key: mq.queue, value: test}
+  refs:
+  - {parentEndpointId: 0, parentEndpoint: 
/rabbitmq-scenario/case/rabbitmq, networkAddressId: 0,entryEndpointId: 0, 
refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not 
null,parentServiceInstanceId: nq 0, networkAddress: not null, entryEndpoint: 
/rabbitmq-scenario/case/rabbitmq,entryServiceInstanceId: nq 0}
+  - segmentId: not null
+spans:
+- operationName: RabbitMQ/Topic/Queue/test/Producer
+  operationId: 0
+  parentSpanId: 0
+  spanId: 1
+  spanLayer: MQ
+  startTime: nq 0
+  endTime: nq 0
+  componentId: 52
+  componentName: ''
+  isError: false
+  spanType: Exit
+  peer: not null
+  peerId: 0
+  tags:
+  - {key: mq.broker, value: 'not null'}
+  - {key: mq.queue, value: test}
+  - {key: mq.topic, value: ''}
+- operationName: /rabbitmq-scenario/case/rabbitmq
+  operationId: 0
+  parentSpanId: -1
+  spanId: 0
+  spanLayer: Http
+  startTime: nq 0
+  endTime: nq 0
+  componentId: 1
+  componentName: ''
+  isError: false
+  spanType: Entry
+  peer: ''
+  peerId: 0
+  tags:
+  - {key: url, value: 
'http://localhost:8080/rabbitmq-scenario/case/rabbitmq'}
+  - {key: http.method, value: GET}
+  - segmentId: not null
+spans:
+- operationName: /rabbitmq-scenario/case/healthcheck
+  operationId: 0
 
 Review comment:
   Don't need healthcheck segment


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services