Search in sources :

Example 6 with SpecificExecutionProfile

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

the class ExecutionProfilesInfoFinderTest method should_include_info_about_default_profile_and_only_difference_for_specific_profile.

@Test
@UseDataProvider("executionProfileProvider")
public void should_include_info_about_default_profile_and_only_difference_for_specific_profile(DriverExecutionProfile nonDefaultExecutionProfile, SpecificExecutionProfile expected) {
    // given
    DriverExecutionProfile defaultExecutionProfile = mockDefaultExecutionProfile();
    Map<String, DriverExecutionProfile> profiles = ImmutableMap.of("default", defaultExecutionProfile, "non-default", nonDefaultExecutionProfile);
    InternalDriverContext context = mockDriverContextWithProfiles(defaultExecutionProfile, profiles);
    // when
    Map<String, SpecificExecutionProfile> executionProfilesInfo = new ExecutionProfilesInfoFinder().getExecutionProfilesInfo(context);
    // then
    assertThat(executionProfilesInfo).isEqualTo(ImmutableMap.of("default", new SpecificExecutionProfile(100, new LoadBalancingInfo("LoadBalancingPolicyImpl", ImmutableMap.of("localDataCenter", "local-dc", "filterFunction", true), DEFAULT_LOAD_BALANCING_PACKAGE), new SpeculativeExecutionInfo("SpeculativeExecutionImpl", ImmutableMap.of("maxSpeculativeExecutions", 100, "delay", 20), DEFAULT_SPECULATIVE_EXECUTION_PACKAGE), "LOCAL_ONE", "SERIAL", ImmutableMap.of("source", "src-graph")), "non-default", expected));
}
Also used : DriverExecutionProfile(com.datastax.oss.driver.api.core.config.DriverExecutionProfile) LoadBalancingInfo(com.datastax.dse.driver.internal.core.insights.schema.LoadBalancingInfo) SpecificExecutionProfile(com.datastax.dse.driver.internal.core.insights.schema.SpecificExecutionProfile) InternalDriverContext(com.datastax.oss.driver.internal.core.context.InternalDriverContext) SpeculativeExecutionInfo(com.datastax.dse.driver.internal.core.insights.schema.SpeculativeExecutionInfo) ExecutionProfileMockUtil.mockNonDefaultSpeculativeExecutionInfo(com.datastax.dse.driver.internal.core.insights.ExecutionProfileMockUtil.mockNonDefaultSpeculativeExecutionInfo) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Aggregations

SpecificExecutionProfile (com.datastax.dse.driver.internal.core.insights.schema.SpecificExecutionProfile)6 Test (org.junit.Test)5 LoadBalancingInfo (com.datastax.dse.driver.internal.core.insights.schema.LoadBalancingInfo)4 SpeculativeExecutionInfo (com.datastax.dse.driver.internal.core.insights.schema.SpeculativeExecutionInfo)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ExecutionProfileMockUtil.mockNonDefaultSpeculativeExecutionInfo (com.datastax.dse.driver.internal.core.insights.ExecutionProfileMockUtil.mockNonDefaultSpeculativeExecutionInfo)2 DriverExecutionProfile (com.datastax.oss.driver.api.core.config.DriverExecutionProfile)2 InternalDriverContext (com.datastax.oss.driver.internal.core.context.InternalDriverContext)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 RuntimeAndCompileTimeVersions (com.datastax.dse.driver.internal.core.insights.schema.InsightsPlatformInfo.RuntimeAndCompileTimeVersions)1 InsightsStartupData (com.datastax.dse.driver.internal.core.insights.schema.InsightsStartupData)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 DefaultDriverContext (com.datastax.oss.driver.internal.core.context.DefaultDriverContext)1