Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions core-api/src/main/java/com/optimizely/ab/Optimizely.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
import com.optimizely.ab.event.EventHandler;
import com.optimizely.ab.event.LogEvent;
import com.optimizely.ab.event.internal.BuildVersionInfo;
import com.optimizely.ab.event.internal.EventBuilder;
import com.optimizely.ab.event.internal.EventFactory;
import com.optimizely.ab.event.internal.payload.EventBatch.ClientEngine;
import com.optimizely.ab.internal.ControlAttribute;
import com.optimizely.ab.notification.NotificationCenter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -82,7 +81,7 @@ public class Optimizely {
private static final Logger logger = LoggerFactory.getLogger(Optimizely.class);

@VisibleForTesting final DecisionService decisionService;
@VisibleForTesting final EventBuilder eventBuilder;
@VisibleForTesting final EventFactory eventFactory;
@VisibleForTesting final ProjectConfig projectConfig;
@VisibleForTesting final EventHandler eventHandler;
@VisibleForTesting final ErrorHandler errorHandler;
Expand All @@ -93,13 +92,13 @@ public class Optimizely {
private Optimizely(@Nonnull ProjectConfig projectConfig,
@Nonnull DecisionService decisionService,
@Nonnull EventHandler eventHandler,
@Nonnull EventBuilder eventBuilder,
@Nonnull EventFactory eventFactory,
@Nonnull ErrorHandler errorHandler,
@Nullable UserProfileService userProfileService) {
this.projectConfig = projectConfig;
this.decisionService = decisionService;
this.eventHandler = eventHandler;
this.eventBuilder = eventBuilder;
this.eventFactory = eventFactory;
this.errorHandler = errorHandler;
this.userProfileService = userProfileService;
}
Expand Down Expand Up @@ -193,7 +192,7 @@ private void sendImpression(@Nonnull ProjectConfig projectConfig,
@Nonnull Map<String, String> filteredAttributes,
@Nonnull Variation variation) {
if (experiment.isRunning()) {
LogEvent impressionEvent = eventBuilder.createImpressionEvent(
LogEvent impressionEvent = eventFactory.createImpressionEvent(
projectConfig,
experiment,
variation,
Expand Down Expand Up @@ -279,7 +278,7 @@ public void track(@Nonnull String eventName,
}

// create the conversion event request parameters, then dispatch
LogEvent conversionEvent = eventBuilder.createConversionEvent(
LogEvent conversionEvent = eventFactory.createConversionEvent(
projectConfig,
experimentVariationMap,
userId,
Expand Down Expand Up @@ -829,7 +828,7 @@ public static class Builder {
private DecisionService decisionService;
private ErrorHandler errorHandler;
private EventHandler eventHandler;
private EventBuilder eventBuilder;
private EventFactory eventFactory;
private ClientEngine clientEngine;
private String clientVersion;
private ProjectConfig projectConfig;
Expand Down Expand Up @@ -871,8 +870,8 @@ public Builder withClientVersion(String clientVersion) {
return this;
}

protected Builder withEventBuilder(EventBuilder eventBuilder) {
this.eventBuilder = eventBuilder;
protected Builder withEventBuilder(EventFactory eventFactory) {
this.eventFactory = eventFactory;
return this;
}

Expand Down Expand Up @@ -900,8 +899,8 @@ public Optimizely build() throws ConfigParseException {
}


if (eventBuilder == null) {
eventBuilder = new EventBuilder(clientEngine, clientVersion);
if (eventFactory == null) {
eventFactory = new EventFactory(clientEngine, clientVersion);
}

if (errorHandler == null) {
Expand All @@ -912,7 +911,7 @@ public Optimizely build() throws ConfigParseException {
decisionService = new DecisionService(bucketer, errorHandler, projectConfig, userProfileService);
}

Optimizely optimizely = new Optimizely(projectConfig, decisionService, eventHandler, eventBuilder, errorHandler, userProfileService);
Optimizely optimizely = new Optimizely(projectConfig, decisionService, eventHandler, eventFactory, errorHandler, userProfileService);
optimizely.initialize();
return optimizely;
}
Expand Down

This file was deleted.

Loading