use of com.optimizely.ab.config.ProjectConfig in project java-sdk by optimizely.
the class JsonSimpleConfigParserTest method parseFeatureVariablesWithFutureType.
@Test
public void parseFeatureVariablesWithFutureType() throws Exception {
JsonSimpleConfigParser parser = new JsonSimpleConfigParser();
ProjectConfig actual = parser.parseProjectConfig(validConfigJsonV4());
// unknown type
FeatureFlag featureFlag = actual.getFeatureKeyMapping().get("multi_variate_future_feature");
FeatureVariable variable = featureFlag.getVariableKeyToFeatureVariableMap().get("future_variable");
assertEquals(variable.getType(), "future_type");
}
use of com.optimizely.ab.config.ProjectConfig in project java-sdk by optimizely.
the class JsonSimpleConfigParserTest method parseProjectConfigV3.
@Test
public void parseProjectConfigV3() throws Exception {
JsonSimpleConfigParser parser = new JsonSimpleConfigParser();
ProjectConfig actual = parser.parseProjectConfig(validConfigJsonV3());
ProjectConfig expected = validProjectConfigV3();
verifyProjectConfig(actual, expected);
}
use of com.optimizely.ab.config.ProjectConfig in project java-sdk by optimizely.
the class BatchEventProcessorTest method testFlushOnMismatchProjectId.
@Test
public void testFlushOnMismatchProjectId() throws Exception {
setEventProcessor(logEvent -> eventHandlerRule.dispatchEvent(logEvent));
ProjectConfig projectConfig1 = mock(ProjectConfig.class);
when(projectConfig1.getRevision()).thenReturn("1");
when(projectConfig1.getProjectId()).thenReturn("X");
UserEvent userEvent1 = buildConversionEvent(EVENT_NAME, projectConfig1);
eventProcessor.process(userEvent1);
eventHandlerRule.expectConversion(EVENT_NAME, USER_ID);
ProjectConfig projectConfig2 = mock(ProjectConfig.class);
when(projectConfig1.getRevision()).thenReturn("1");
when(projectConfig2.getProjectId()).thenReturn("Y");
UserEvent userEvent2 = buildConversionEvent(EVENT_NAME, projectConfig2);
eventProcessor.process(userEvent2);
eventHandlerRule.expectConversion(EVENT_NAME, USER_ID);
eventProcessor.close();
eventHandlerRule.expectCalls(2);
}
use of com.optimizely.ab.config.ProjectConfig in project java-sdk by optimizely.
the class JacksonConfigParserTest method parseFeatureVariablesWithJsonPatched.
@Test
public void parseFeatureVariablesWithJsonPatched() throws Exception {
JsonSimpleConfigParser parser = new JsonSimpleConfigParser();
ProjectConfig actual = parser.parseProjectConfig(validConfigJsonV4());
// "string" type + "json" subType
FeatureFlag featureFlag = actual.getFeatureKeyMapping().get("multi_variate_feature");
FeatureVariable variable = featureFlag.getVariableKeyToFeatureVariableMap().get("json_patched");
assertEquals(variable.getType(), "json");
}
use of com.optimizely.ab.config.ProjectConfig in project java-sdk by optimizely.
the class JacksonConfigParserTest method parseNullFeatureEnabledProjectConfigV4.
@Test
public void parseNullFeatureEnabledProjectConfigV4() throws Exception {
JacksonConfigParser parser = new JacksonConfigParser();
ProjectConfig actual = parser.parseProjectConfig(nullFeatureEnabledConfigJsonV4());
assertNotNull(actual);
assertNotNull(actual.getExperiments());
assertNotNull(actual.getFeatureFlags());
}
Aggregations