aboutsummaryrefslogtreecommitdiffstats
path: root/impl_lite
diff options
context:
space:
mode:
authorBogdan Drutu <bdrutu@google.com>2017-06-15 11:29:30 -0700
committerGitHub <noreply@github.com>2017-06-15 11:29:30 -0700
commit3b74070f74a75e780828370126b713524eece13c (patch)
treeae6bc5deb968cbfab938b355718898c84fbb0826 /impl_lite
parent461b4ed4a37e74a42c8ba6264807a15e36ab9dc6 (diff)
downloadplatform_external_opencensus-java-3b74070f74a75e780828370126b713524eece13c.tar.gz
platform_external_opencensus-java-3b74070f74a75e780828370126b713524eece13c.tar.bz2
platform_external_opencensus-java-3b74070f74a75e780828370126b713524eece13c.zip
Prepare the release of the opencensus library. (#357)
Diffstat (limited to 'impl_lite')
-rw-r--r--impl_lite/README.md6
-rw-r--r--impl_lite/build.gradle8
-rw-r--r--impl_lite/src/main/java/io/opencensus/trace/TraceComponentImpl.java26
-rw-r--r--impl_lite/src/test/java/io/opencensus/trace/TraceComponentImplTest.java48
4 files changed, 88 insertions, 0 deletions
diff --git a/impl_lite/README.md b/impl_lite/README.md
new file mode 100644
index 00000000..ad7bb9b1
--- /dev/null
+++ b/impl_lite/README.md
@@ -0,0 +1,6 @@
+OpenCensus Android implementation
+======================================================
+
+* Android compatible.
+* StatsManager specifies the stats implementation classes that should be used
+ with Android.
diff --git a/impl_lite/build.gradle b/impl_lite/build.gradle
new file mode 100644
index 00000000..40cce82a
--- /dev/null
+++ b/impl_lite/build.gradle
@@ -0,0 +1,8 @@
+description = 'OpenCensus Lite Implementation'
+
+dependencies {
+ compile project(':opencensus-api'),
+ project(':opencensus-impl-core')
+
+ signature "net.sf.androidscents.signature:android-api-level-14:+@signature"
+}
diff --git a/impl_lite/src/main/java/io/opencensus/trace/TraceComponentImpl.java b/impl_lite/src/main/java/io/opencensus/trace/TraceComponentImpl.java
new file mode 100644
index 00000000..ca806508
--- /dev/null
+++ b/impl_lite/src/main/java/io/opencensus/trace/TraceComponentImpl.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017, Google Inc.
+ * 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
+ * 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.opencensus.trace;
+
+import io.opencensus.common.MillisClock;
+import io.opencensus.internal.SimpleEventQueue;
+import io.opencensus.trace.internal.RandomHandler.SecureRandomHandler;
+
+/** Android-compatible implementation of the {@link TraceComponent}. */
+public final class TraceComponentImpl extends TraceComponentImplBase {
+
+ public TraceComponentImpl() {
+ super(MillisClock.getInstance(), new SecureRandomHandler(), new SimpleEventQueue());
+ }
+}
diff --git a/impl_lite/src/test/java/io/opencensus/trace/TraceComponentImplTest.java b/impl_lite/src/test/java/io/opencensus/trace/TraceComponentImplTest.java
new file mode 100644
index 00000000..024e8692
--- /dev/null
+++ b/impl_lite/src/test/java/io/opencensus/trace/TraceComponentImplTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2017, Google Inc.
+ * 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
+ * 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.opencensus.trace;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import io.opencensus.common.MillisClock;
+import io.opencensus.trace.export.ExportComponentImpl;
+import io.opencensus.trace.propagation.PropagationComponentImpl;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Unit tests for {@link TraceComponentImpl}. */
+@RunWith(JUnit4.class)
+public class TraceComponentImplTest {
+ @Test
+ public void implementationOfTracer() {
+ assertThat(Tracing.getTracer()).isInstanceOf(TracerImpl.class);
+ }
+
+ @Test
+ public void implementationOfBinaryPropagationHandler() {
+ assertThat(Tracing.getPropagationComponent())
+ .isInstanceOf(PropagationComponentImpl.class);
+ }
+
+ @Test
+ public void implementationOfClock() {
+ assertThat(Tracing.getClock()).isInstanceOf(MillisClock.class);
+ }
+
+ @Test
+ public void implementationOfTraceExporter() {
+ assertThat(Tracing.getTraceExporter()).isInstanceOf(ExportComponentImpl.class);
+ }
+}