Search in sources :

Example 6 with RuntimeAndCompileTimeVersions

use of com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions in project java-driver by datastax.

the class PlatformInfoFinderTest method should_load_runtime_version_from_pom_properties_URL.

@Test
public void should_load_runtime_version_from_pom_properties_URL() {
    // given
    InputStream inputStream = this.getClass().getResourceAsStream("/insights/netty-dependency.txt");
    Map<String, RuntimeAndCompileTimeVersions> expected = new LinkedHashMap<>();
    expected.put("io.netty:netty-handler", new RuntimeAndCompileTimeVersions("4.0.56.Final", "4.0.0.Final", false));
    // when
    Map<String, RuntimeAndCompileTimeVersions> stringStringMap = new PlatformInfoFinder(this::nettyUrlProvider).fetchDependenciesFromFile(inputStream);
    // then
    assertThat(stringStringMap).isEqualTo(expected);
}
Also used : InputStream(java.io.InputStream) RuntimeAndCompileTimeVersions(com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 7 with RuntimeAndCompileTimeVersions

use of com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions in project java-driver by datastax.

the class PlatformInfoFinderTest method should_not_load_runtime_dependency_from_non_existing_pom_properties.

@Test
public void should_not_load_runtime_dependency_from_non_existing_pom_properties() {
    // given
    InputStream inputStream = this.getClass().getResourceAsStream("/insights/netty-dependency.txt");
    Map<String, RuntimeAndCompileTimeVersions> expected = new LinkedHashMap<>();
    expected.put("io.netty:netty-handler", withUnverifiedRuntimeVersion("4.0.0.Final"));
    // when
    Map<String, RuntimeAndCompileTimeVersions> stringStringMap = new PlatformInfoFinder(this::nonExistingUrlProvider).fetchDependenciesFromFile(inputStream);
    // then
    assertThat(stringStringMap).isEqualTo(expected);
}
Also used : InputStream(java.io.InputStream) RuntimeAndCompileTimeVersions(com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 8 with RuntimeAndCompileTimeVersions

use of com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions in project java-driver by datastax.

the class PlatformInfoFinderTest method should_load_runtime_version_of_optional_dependency_from_pom_properties_URL.

@Test
public void should_load_runtime_version_of_optional_dependency_from_pom_properties_URL() {
    // given
    InputStream inputStream = this.getClass().getResourceAsStream("/insights/netty-dependency-optional.txt");
    Map<String, RuntimeAndCompileTimeVersions> expected = new LinkedHashMap<>();
    expected.put("io.netty:netty-handler", new RuntimeAndCompileTimeVersions("4.0.56.Final", "4.0.0.Final", true));
    // when
    Map<String, RuntimeAndCompileTimeVersions> stringStringMap = new PlatformInfoFinder(this::nettyUrlProvider).fetchDependenciesFromFile(inputStream);
    // then
    assertThat(stringStringMap).isEqualTo(expected);
}
Also used : InputStream(java.io.InputStream) RuntimeAndCompileTimeVersions(com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 9 with RuntimeAndCompileTimeVersions

use of com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions in project java-driver by datastax.

the class PlatformInfoFinderTest method should_find_dependencies_from_file.

@Test
public void should_find_dependencies_from_file() {
    // given
    InputStream inputStream = this.getClass().getResourceAsStream("/insights/test-dependencies.txt");
    Map<String, RuntimeAndCompileTimeVersions> expected = new HashMap<>();
    expected.put("io.netty:netty-transport-native-epoll", withUnverifiedRuntimeVersionOptional("4.0.56.Final"));
    expected.put("org.slf4j:slf4j-api", withUnverifiedRuntimeVersion("1.7.25"));
    expected.put("org.ow2.asm:asm", withUnverifiedRuntimeVersion("5.0.3"));
    expected.put("com.esri.geometry:esri-geometry-api", withUnverifiedRuntimeVersion("1.2.1"));
    expected.put("io.netty:netty-transport", withUnverifiedRuntimeVersion("4.0.56.Final"));
    expected.put("com.github.jnr:jnr-x86asm", withUnverifiedRuntimeVersion("1.0.2"));
    expected.put("org.ow2.asm:asm-analysis", withUnverifiedRuntimeVersion("5.0.3"));
    expected.put("com.github.jnr:jnr-constants", withUnverifiedRuntimeVersion("0.9.9"));
    expected.put("io.netty:netty-common", withUnverifiedRuntimeVersion("4.0.56.Final"));
    expected.put("com.google.guava:guava", withUnverifiedRuntimeVersion("19.0"));
    expected.put("org.xerial.snappy:snappy-java", withUnverifiedRuntimeVersionOptional("1.1.2.6"));
    expected.put("io.dropwizard.metrics:metrics-core", withUnverifiedRuntimeVersion("3.2.2"));
    expected.put("org.ow2.asm:asm-tree", withUnverifiedRuntimeVersion("5.0.3"));
    expected.put("com.github.jnr:jnr-posix", withUnverifiedRuntimeVersion("3.0.44"));
    expected.put("org.codehaus.jackson:jackson-core-asl", withUnverifiedRuntimeVersion("1.9.12"));
    expected.put("com.fasterxml.jackson.core:jackson-databind", withUnverifiedRuntimeVersion("2.7.9.3"));
    expected.put("io.netty:netty-codec", withUnverifiedRuntimeVersion("4.0.56.Final"));
    expected.put("com.fasterxml.jackson.core:jackson-annotations", withUnverifiedRuntimeVersion("2.8.11"));
    expected.put("com.fasterxml.jackson.core:jackson-core", withUnverifiedRuntimeVersion("2.8.11"));
    expected.put("io.netty:netty-handler", withUnverifiedRuntimeVersion("4.0.56.Final"));
    expected.put("org.lz4:lz4-java", withUnverifiedRuntimeVersionOptional("1.4.1"));
    expected.put("org.hdrhistogram:HdrHistogram", withUnverifiedRuntimeVersionOptional("2.1.10"));
    expected.put("com.github.jnr:jffi", withUnverifiedRuntimeVersion("1.2.16"));
    expected.put("io.netty:netty-buffer", withUnverifiedRuntimeVersion("4.0.56.Final"));
    expected.put("org.ow2.asm:asm-commons", withUnverifiedRuntimeVersion("5.0.3"));
    expected.put("org.json:json", withUnverifiedRuntimeVersion("20090211"));
    expected.put("org.ow2.asm:asm-util", withUnverifiedRuntimeVersion("5.0.3"));
    expected.put("com.github.jnr:jnr-ffi", withUnverifiedRuntimeVersion("2.1.7"));
    // when
    Map<String, RuntimeAndCompileTimeVersions> stringStringMap = new PlatformInfoFinder(this::nullUrlProvider).fetchDependenciesFromFile(inputStream);
    // then
    assertThat(stringStringMap).hasSize(28);
    assertThat(stringStringMap).isEqualTo(expected);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) InputStream(java.io.InputStream) RuntimeAndCompileTimeVersions(com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions) Test(org.junit.Test)

Aggregations

RuntimeAndCompileTimeVersions (com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions)9 Test (org.junit.Test)8 InputStream (java.io.InputStream)7 LinkedHashMap (java.util.LinkedHashMap)6 HashMap (java.util.HashMap)2 AuthProviderType (com.datastax.dse.driver.internal.core.insights.schema.AuthProviderType)1 Insight (com.datastax.dse.driver.internal.core.insights.schema.Insight)1 InsightMetadata (com.datastax.dse.driver.internal.core.insights.schema.InsightMetadata)1 InsightsPlatformInfo (com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo)1 CPUS (com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.CPUS)1 OS (com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.OS)1 InsightsStartupData (com.datastax.dse.driver.internal.core.insights.schema.InsightsStartupData)1 LoadBalancingInfo (com.datastax.dse.driver.internal.core.insights.schema.LoadBalancingInfo)1 PoolSizeByHostDistance (com.datastax.dse.driver.internal.core.insights.schema.PoolSizeByHostDistance)1 ReconnectionPolicyInfo (com.datastax.dse.driver.internal.core.insights.schema.ReconnectionPolicyInfo)1 SSL (com.datastax.dse.driver.internal.core.insights.schema.SSL)1 SpecificExecutionProfile (com.datastax.dse.driver.internal.core.insights.schema.SpecificExecutionProfile)1 SpeculativeExecutionInfo (com.datastax.dse.driver.internal.core.insights.schema.SpeculativeExecutionInfo)1 DefaultDriverContext (com.datastax.oss.driver.internal.core.context.DefaultDriverContext)1 ImmutableMap (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap)1