diff --git a/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java b/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java index 9b556860df9..0e293672515 100644 --- a/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java +++ b/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessor.java @@ -1,6 +1,5 @@ package com.microsoft.applicationinsights.internal.channel.samplingV2; -import com.microsoft.applicationinsights.agent.internal.common.StringUtils; import com.microsoft.applicationinsights.extensibility.TelemetryProcessor; import com.microsoft.applicationinsights.internal.annotation.BuiltInProcessor; import com.microsoft.applicationinsights.internal.logger.InternalLogger; @@ -12,6 +11,8 @@ import java.util.Map; import java.util.Set; +import org.apache.commons.lang3.StringUtils; + /** * This processor is used to Perform Sampling on User specified sampling rate *

@@ -99,9 +100,9 @@ public Set getIncludedTypes() { private void setIncludedOrExcludedTypes(String value, Set typeSet) { - if (!StringUtils.isNullOrEmpty(value)) { + if (!StringUtils.isEmpty(value)) { value = value.trim(); - if (!StringUtils.isNullOrEmpty(value) && allowedTypes.containsKey(value)) { + if (!StringUtils.isEmpty(value) && allowedTypes.containsKey(value)) { typeSet.add(allowedTypes.get(value)); } else { InternalLogger.INSTANCE.error("Item is either not allowed to sample or is empty"); diff --git a/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/SamplingScoreGeneratorV2.java b/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/SamplingScoreGeneratorV2.java index 11c4be0d1b5..7f9b35e065c 100644 --- a/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/SamplingScoreGeneratorV2.java +++ b/core/src/main/java/com/microsoft/applicationinsights/internal/channel/samplingV2/SamplingScoreGeneratorV2.java @@ -1,9 +1,9 @@ package com.microsoft.applicationinsights.internal.channel.samplingV2; -import com.microsoft.applicationinsights.agent.internal.common.StringUtils; import com.microsoft.applicationinsights.telemetry.Telemetry; import java.util.Random; +import org.apache.commons.lang3.StringUtils; /** * Created by Dhaval Doshi Oct 2017 @@ -24,7 +24,7 @@ public static double getSamplingScore(Telemetry telemetry) { double samplingScore = 0.0; - if (!StringUtils.isNullOrEmpty(telemetry.getContext().getOperation().getId())) { + if (!StringUtils.isEmpty(telemetry.getContext().getOperation().getId())) { samplingScore = ((double) getSamplingHashCode(telemetry.getContext().getOperation().getId()) / Integer.MAX_VALUE); } @@ -37,7 +37,7 @@ public static double getSamplingScore(Telemetry telemetry) { } static int getSamplingHashCode(String input) { - if (StringUtils.isNullOrEmpty(input)) { + if (StringUtils.isEmpty(input)) { return 0; } diff --git a/core/src/test/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessorTest.java b/core/src/test/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessorTest.java index da96d3720e9..dce24521527 100644 --- a/core/src/test/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessorTest.java +++ b/core/src/test/java/com/microsoft/applicationinsights/internal/channel/samplingV2/FixedRateSamplingTelemetryProcessorTest.java @@ -3,13 +3,13 @@ import com.microsoft.applicationinsights.TelemetryClient; import com.microsoft.applicationinsights.TelemetryConfiguration; import com.microsoft.applicationinsights.TestFramework.StubTelemetryChannel; -import com.microsoft.applicationinsights.agent.internal.common.StringUtils; import com.microsoft.applicationinsights.extensibility.TelemetryProcessor; import com.microsoft.applicationinsights.telemetry.PageViewTelemetry; import com.microsoft.applicationinsights.telemetry.RemoteDependencyTelemetry; import com.microsoft.applicationinsights.telemetry.RequestTelemetry; import com.microsoft.applicationinsights.telemetry.SupportSampling; import com.microsoft.applicationinsights.telemetry.Telemetry; +import org.apache.commons.lang3.StringUtils; import org.junit.Assert; import org.junit.Test; @@ -513,7 +513,7 @@ private void testSampling(TelemetryClient client , List> depende processor.setSamplingPercentage(String.valueOf(samplingRate)); if (includeTypes != null) { for (String includeType : includeTypes) { - if (!StringUtils.isNullOrEmpty(includeType)) { + if (!StringUtils.isEmpty(includeType)) { processor.addToIncludedType(includeType); } } @@ -521,7 +521,7 @@ private void testSampling(TelemetryClient client , List> depende if (excludeTypes != null) { for (String excludeType : excludeTypes) { - if (!StringUtils.isNullOrEmpty(excludeType)) { + if (!StringUtils.isEmpty(excludeType)) { processor.addToExcludedType(excludeType); } } @@ -559,7 +559,7 @@ private void testNoSampling(TelemetryClient client , List> depen processor.setSamplingPercentage(String.valueOf(samplingRate)); if (includeTypes != null) { for (String includeType : includeTypes) { - if (!StringUtils.isNullOrEmpty(includeType)) { + if (!StringUtils.isEmpty(includeType)) { processor.addToIncludedType(includeType); } } @@ -567,7 +567,7 @@ private void testNoSampling(TelemetryClient client , List> depen if (excludeTypes != null) { for (String excludeType : excludeTypes) { - if (!StringUtils.isNullOrEmpty(excludeType)) { + if (!StringUtils.isEmpty(excludeType)) { processor.addToExcludedType(excludeType); } } diff --git a/gradle/provided-configuration.gradle b/gradle/provided-configuration.gradle index 4aa7fe351b7..a87e81bc3e8 100644 --- a/gradle/provided-configuration.gradle +++ b/gradle/provided-configuration.gradle @@ -19,21 +19,18 @@ * DEALINGS IN THE SOFTWARE. */ -// Adding the "provided" configuration - -ext { - PROVIDED_CONFIGURATION_NAME = "provided" +// Defines the "provided" configuration for dependencies that the client is responsible for including on the classpath +configurations { + provided } -configurations { - provided { - // Remove the provided dependencies from the default configuration so - // these dependencies won't be derived by projects that has a dependency on - // the project using the provided scope - dependencies.all { dep -> - configurations.default.exclude group: dep.group, module: dep.name - } +sourceSets { + main { + compileClasspath += configurations.provided + runtimeClasspath += configurations.provided + } + test { + compileClasspath += configurations.provided + runtimeClasspath += configurations.provided } - compile.extendsFrom provided } -