You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/01/02 10:44:20 UTC
[incubator-servicecomb-java-chassis] 02/14: JAV-508 & SCB-11 change
to asf license and add test case
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit c100420eeae135f2a10b2fb225556fd9a4bebbc5
Author: zhengyangyong <ya...@huawei.com>
AuthorDate: Thu Dec 21 09:45:01 2017 +0800
JAV-508 & SCB-11 change to asf license and add test case
Signed-off-by: zhengyangyong <ya...@huawei.com>
---
.../metrics/core/publish/JsonMetricsPublisher.java | 13 +++----
.../metrics/core/publish/MetricsBootListener.java | 13 +++----
.../metrics/core/publish/MetricsPublisher.java | 13 +++----
...ecomb_internal_metrics_contract_definition.yaml | 17 +++++++++
.../io/servicecomb/metrics/core/TestPublisher.java | 42 ++++++++++++++++++++++
.../metrics-performance-test/pom.xml | 21 +++++------
metrics/metrics-sample/pom.xml | 21 +++++------
metrics/pom.xml | 21 +++++------
8 files changed, 113 insertions(+), 48 deletions(-)
diff --git a/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/JsonMetricsPublisher.java b/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/JsonMetricsPublisher.java
index a4caf70..535c6de 100644
--- a/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/JsonMetricsPublisher.java
+++ b/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/JsonMetricsPublisher.java
@@ -1,11 +1,12 @@
/*
- * Copyright 2017 Huawei Technologies Co., Ltd
+ * 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
*
- * Licensed 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
+ * 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,
diff --git a/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/MetricsBootListener.java b/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/MetricsBootListener.java
index a307788..9d9571f 100644
--- a/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/MetricsBootListener.java
+++ b/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/MetricsBootListener.java
@@ -1,11 +1,12 @@
/*
- * Copyright 2017 Huawei Technologies Co., Ltd
+ * 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
*
- * Licensed 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
+ * 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,
diff --git a/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/MetricsPublisher.java b/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/MetricsPublisher.java
index c9abf17..29cf1d8 100644
--- a/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/MetricsPublisher.java
+++ b/metrics/metrics-core/src/main/java/io/servicecomb/metrics/core/publish/MetricsPublisher.java
@@ -1,11 +1,12 @@
/*
- * Copyright 2017 Huawei Technologies Co., Ltd
+ * 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
*
- * Licensed 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
+ * 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,
diff --git a/metrics/metrics-core/src/main/resources/servicecomb_internal_metrics_contract_definition.yaml b/metrics/metrics-core/src/main/resources/servicecomb_internal_metrics_contract_definition.yaml
index a97e75c..0e4000c 100644
--- a/metrics/metrics-core/src/main/resources/servicecomb_internal_metrics_contract_definition.yaml
+++ b/metrics/metrics-core/src/main/resources/servicecomb_internal_metrics_contract_definition.yaml
@@ -1,3 +1,20 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
swagger: "2.0"
info:
version: "1.0.0"
diff --git a/metrics/metrics-core/src/test/java/io/servicecomb/metrics/core/TestPublisher.java b/metrics/metrics-core/src/test/java/io/servicecomb/metrics/core/TestPublisher.java
new file mode 100644
index 0000000..9700d3b
--- /dev/null
+++ b/metrics/metrics-core/src/test/java/io/servicecomb/metrics/core/TestPublisher.java
@@ -0,0 +1,42 @@
+/*
+ * 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 io.servicecomb.metrics.core;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import io.servicecomb.metrics.core.monitor.RegistryMonitor;
+import io.servicecomb.metrics.core.publish.DefaultDataSource;
+import io.servicecomb.metrics.core.publish.JsonMetricsPublisher;
+
+public class TestPublisher {
+
+ @Test
+ public void test() {
+ RegistryMonitor registryMonitor = new RegistryMonitor();
+ DefaultDataSource dataSource = new DefaultDataSource(registryMonitor);
+ JsonMetricsPublisher publisher = new JsonMetricsPublisher(dataSource);
+ String content = publisher.metrics(0);
+ Assert
+ .assertEquals(content,
+ "{\"instanceMetric\":{\"waitInQueue\":0,\"lifeTimeInQueue\":{\"total\":0,\"count\":0,\"average\":0.0,"+
+ "\"min\":0,\"max\":0},\"executionTime\":{\"total\":0,\"count\":0,\"average\":0.0,\"min\":0,\"max\":0},"+
+ "\"consumerLatency\":{\"total\":0,\"count\":0,\"average\":0.0,\"min\":0,\"max\":0},\"producerLatency"+
+ "\":{\"total\":0,\"count\":0,\"average\":0.0,\"min\":0,\"max\":0}},\"invocationMetrics\":{}}");
+ }
+}
diff --git a/metrics/metrics-sample/metrics-performance-test/pom.xml b/metrics/metrics-sample/metrics-performance-test/pom.xml
index 7b29e7f..7a51ea6 100644
--- a/metrics/metrics-sample/metrics-performance-test/pom.xml
+++ b/metrics/metrics-sample/metrics-performance-test/pom.xml
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2017 Huawei Technologies Co., Ltd
- ~
- ~ Licensed 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
+ ~ 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.
+ ~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
diff --git a/metrics/metrics-sample/pom.xml b/metrics/metrics-sample/pom.xml
index 45c4749..b78f37a 100644
--- a/metrics/metrics-sample/pom.xml
+++ b/metrics/metrics-sample/pom.xml
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2017 Huawei Technologies Co., Ltd
- ~
- ~ Licensed 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
+ ~ 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.
+ ~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
diff --git a/metrics/pom.xml b/metrics/pom.xml
index 8ff8394..80203af 100644
--- a/metrics/pom.xml
+++ b/metrics/pom.xml
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2017 Huawei Technologies Co., Ltd
- ~
- ~ Licensed 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
+ ~ 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.
+ ~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
--
To stop receiving notification emails like this one, please contact
"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>.