You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2014/10/29 00:58:59 UTC
[14/24] PHOENIX-1286 Remove hadoop2 compat modules
http://git-wip-us.apache.org/repos/asf/phoenix/blob/b48ca7b5/phoenix-hadoop2-compat/src/test/java/org/apache/phoenix/trace/TraceMetricsSourceTest.java
----------------------------------------------------------------------
diff --git a/phoenix-hadoop2-compat/src/test/java/org/apache/phoenix/trace/TraceMetricsSourceTest.java b/phoenix-hadoop2-compat/src/test/java/org/apache/phoenix/trace/TraceMetricsSourceTest.java
deleted file mode 100644
index 3258e8a..0000000
--- a/phoenix-hadoop2-compat/src/test/java/org/apache/phoenix/trace/TraceMetricsSourceTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 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.phoenix.trace;
-
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.metrics2.MetricsCollector;
-import org.apache.hadoop.metrics2.MetricsRecordBuilder;
-import org.apache.hadoop.metrics2.MetricsTag;
-import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
-import org.cloudera.htrace.Span;
-import org.cloudera.htrace.impl.MilliSpan;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test that the @{link TraceMetricSource} correctly handles different kinds of traces
- */
-public class TraceMetricsSourceTest {
-
- @BeforeClass
- public static void setup() throws Exception{
- DefaultMetricsSystem.setMiniClusterMode(true);
- }
-
- /**
- * For PHOENIX-1126, Phoenix originally assumed all the annotation values were integers,
- * but HBase writes some strings as well, so we need to be able to handle that too
- */
- @Test
- public void testNonIntegerAnnotations(){
- Span span = getSpan();
- // make sure its less than the length of an integer
- byte[] value = Bytes.toBytes("a");
- byte[] someInt = Bytes.toBytes(1);
- assertTrue(someInt.length >value.length);
-
- // an annotation that is not an integer
- span.addKVAnnotation(Bytes.toBytes("key"), value);
-
- // Create the sink and write the span
- TraceMetricSource source = new TraceMetricSource();
- source.receiveSpan(span);
- }
-
- @Test
- public void testIntegerAnnotations(){
- Span span = getSpan();
-
- // add annotation through the phoenix interfaces
- TracingCompat.addAnnotation(span, "message", 10);
-
- TraceMetricSource source = new TraceMetricSource();
- source.receiveSpan(span);
- }
-
- /**
- * If the source does not write any metrics when there are no spans, i.e. when initialized,
- * then the metrics system will discard the source, so it needs to always emit some metrics.
- */
- @Test
- public void testWritesInfoWhenNoSpans(){
- TraceMetricSource source = new TraceMetricSource();
- MetricsCollector collector = Mockito.mock(MetricsCollector.class);
- MetricsRecordBuilder builder = Mockito.mock(MetricsRecordBuilder.class);
- Mockito.when(collector.addRecord(Mockito.anyString())).thenReturn(builder);
-
- source.getMetrics(collector, true);
-
- // verify that we add a record and that the record has some info
- Mockito.verify(collector).addRecord(Mockito.anyString());
- Mockito.verify(builder).add(Mockito.any(MetricsTag.class));
- }
-
- private Span getSpan(){
- return new MilliSpan("test span", 0, 1 , 2, "pid");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/phoenix/blob/b48ca7b5/phoenix-hadoop2-compat/src/test/java/org/apache/phoenix/trace/TracingTest.java
----------------------------------------------------------------------
diff --git a/phoenix-hadoop2-compat/src/test/java/org/apache/phoenix/trace/TracingTest.java b/phoenix-hadoop2-compat/src/test/java/org/apache/phoenix/trace/TracingTest.java
deleted file mode 100644
index ffe6c82..0000000
--- a/phoenix-hadoop2-compat/src/test/java/org/apache/phoenix/trace/TracingTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.phoenix.trace;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-
-public class TracingTest {
-
- /**
- * Test that we can correctly load a class that will convert the tracing output to metrics
- * @throws Exception on failure
- */
- @Test
- public void testLoadTracingToMetrics() throws Exception{
- assertNotNull("Didn't find a trace receiver", TracingCompat.newTraceMetricSource());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/phoenix/blob/b48ca7b5/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 10ef778..3346ccb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,12 +24,9 @@
<modules>
<module>phoenix-core</module>
- <module>phoenix-hadoop-compat</module>
<module>phoenix-flume</module>
<module>phoenix-pig</module>
<module>phoenix-assembly</module>
- <!--Temporary inclusion - to be removed in next patch, for ease of review -->
- <module>phoenix-hadoop2-compat</module>
</modules>
<repositories>
@@ -411,25 +408,6 @@
</dependency>
<dependency>
<groupId>org.apache.phoenix</groupId>
- <artifactId>phoenix-hadoop-compat</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.phoenix</groupId>
- <artifactId>phoenix-hadoop-compat</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.phoenix</groupId>
- <artifactId>phoenix-hadoop2-compat</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-flume</artifactId>
<version>${project.version}</version>
</dependency>
@@ -438,11 +416,6 @@
<artifactId>phoenix-pig</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.phoenix</groupId>
- <artifactId>phoenix-hadoop2-compat</artifactId>
- <version>${project.version}</version>
- </dependency>
<!-- HBase dependencies -->
<dependency>