Skip to content

Commit 9cb5f71

Browse files
authored
remove revenue APIs (#108)
* remove deprecated revenue methods * remove tests for revenue as a parameter
1 parent 7a53454 commit 9cb5f71

File tree

3 files changed

+4
-107
lines changed

3 files changed

+4
-107
lines changed

core-api/src/jmh/java/com/optimizely/ab/OptimizelyBenchmark.java

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -157,49 +157,27 @@ public Variation measureActivateForGroupExperimentWithForcedVariation() {
157157
}
158158

159159
@Benchmark
160-
public void measureTrackWithNoAttributesAndNoRevenue() {
160+
public void measureTrackWithNoAttributes() {
161161
optimizely.track("testEventWithMultipleExperiments", "optimizely_user" + random.nextInt());
162162
}
163163

164164
@Benchmark
165-
public void measureTrackWithNoAttributesAndRevenue() {
166-
optimizely.track("testEventWithMultipleExperiments", "optimizely_user" + random.nextInt(), 50000);
167-
}
168-
169-
@Benchmark
170-
public void measureTrackWithAttributesAndNoRevenue() {
165+
public void measureTrackWithAttributes() {
171166
optimizely.track("testEventWithMultipleExperiments", "optimizely_user" + random.nextInt(),
172167
Collections.singletonMap("browser_type", "firefox"));
173168
}
174169

175170
@Benchmark
176-
public void measureTrackWithAttributesAndRevenue() {
177-
optimizely.track("testEventWithMultipleExperiments", "optimizely_user" + random.nextInt(),
178-
Collections.singletonMap("browser_type", "firefox"), 50000);
179-
}
180-
181-
@Benchmark
182-
public void measureTrackWithGroupExperimentsNoAttributesNoRevenue() {
171+
public void measureTrackWithGroupExperimentsNoAttributes() {
183172
optimizely.track("testEventWithMultipleExperiments", trackGroupExperimentUserId);
184173
}
185174

186175
@Benchmark
187-
public void measureTrackWithGroupExperimentsNoAttributesAndRevenue() {
188-
optimizely.track("testEventWithMultipleExperiments", trackGroupExperimentUserId, 50000);
189-
}
190-
191-
@Benchmark
192-
public void measureTrackWithGroupExperimentsNoRevenueAndAttributes() {
176+
public void measureTrackWithGroupExperimentsAndAttributes() {
193177
optimizely.track("testEventWithMultipleExperiments", trackGroupExperimentAttributesUserId,
194178
Collections.singletonMap("browser_type", "chrome"));
195179
}
196180

197-
@Benchmark
198-
public void measureTrackWithGroupExperimentsAndAttributesAndRevenue() {
199-
optimizely.track("testEventWithMultipleExperiments", trackGroupExperimentAttributesUserId,
200-
Collections.singletonMap("browser_type", "chrome"), 50000);
201-
}
202-
203181
@Benchmark
204182
public void measureTrackWithGroupExperimentsAndForcedVariation() {
205183
optimizely.track("testEventWithMultipleExperiments", "user_a");

core-api/src/main/java/com/optimizely/ab/Optimizely.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,6 @@ public void track(@Nonnull String eventName,
213213
track(eventName, userId, attributes, Collections.<String, String>emptyMap());
214214
}
215215

216-
/**
217-
* @deprecated see {@link #track(String, String, Map)} and pass in the revenue value as an event tag instead.
218-
*/
219-
public void track(@Nonnull String eventName,
220-
@Nonnull String userId,
221-
long eventValue) throws UnknownEventTypeException {
222-
track(eventName, userId, Collections.<String, String>emptyMap(), Collections.singletonMap(
223-
ReservedEventKey.REVENUE.toString(), eventValue));
224-
}
225-
226-
/**
227-
* @deprecated see {@link #track(String, String, Map, long)} and pass in the revenue value as an event tag instead.
228-
*/
229-
public void track(@Nonnull String eventName,
230-
@Nonnull String userId,
231-
@Nonnull Map<String, String> attributes,
232-
long eventValue) throws UnknownEventTypeException {
233-
track(eventName, userId, attributes, Collections.singletonMap(ReservedEventKey.REVENUE.toString(), eventValue));
234-
}
235-
236216
public void track(@Nonnull String eventName,
237217
@Nonnull String userId,
238218
@Nonnull Map<String, String> attributes,

core-api/src/test/java/com/optimizely/ab/OptimizelyTest.java

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,67 +1140,6 @@ public void trackEventWithUnknownAttribute() throws Exception {
11401140
verify(mockEventHandler).dispatchEvent(logEventToDispatch);
11411141
}
11421142

1143-
/**
1144-
* Verify that {@link Optimizely#track(String, String, long)} passes through revenue.
1145-
*/
1146-
@Test
1147-
public void trackEventWithRevenue() throws Exception {
1148-
EventType eventType = validProjectConfig.getEventTypes().get(0);
1149-
long revenue = 1234L;
1150-
1151-
// setup a mock event builder to return expected conversion params
1152-
EventBuilder mockEventBuilder = mock(EventBuilder.class);
1153-
1154-
Optimizely optimizely = Optimizely.builder(validDatafile, mockEventHandler)
1155-
.withBucketing(mockBucketer)
1156-
.withEventBuilder(mockEventBuilder)
1157-
.withConfig(validProjectConfig)
1158-
.withErrorHandler(mockErrorHandler)
1159-
.build();
1160-
1161-
Map<String, String> testParams = new HashMap<String, String>();
1162-
testParams.put("test", "params");
1163-
Map<String, Object> eventTags= new HashMap<String, Object>();
1164-
eventTags.put(ReservedEventKey.REVENUE.toString(), revenue);
1165-
Map<Experiment, Variation> experimentVariationMap = createExperimentVariationMap(
1166-
validProjectConfig,
1167-
mockBucketer,
1168-
eventType.getKey(),
1169-
genericUserId,
1170-
Collections.<String, String>emptyMap());
1171-
LogEvent logEventToDispatch = new LogEvent(RequestMethod.GET, "test_url", testParams, "");
1172-
when(mockEventBuilder.createConversionEvent(
1173-
eq(validProjectConfig),
1174-
eq(experimentVariationMap),
1175-
eq(genericUserId),
1176-
eq(eventType.getId()),
1177-
eq(eventType.getKey()),
1178-
eq(Collections.<String, String>emptyMap()),
1179-
eq(eventTags)))
1180-
.thenReturn(logEventToDispatch);
1181-
1182-
// call track
1183-
optimizely.track(eventType.getKey(), genericUserId, revenue);
1184-
1185-
// setup the event tag map captor (so we can verify its content)
1186-
ArgumentCaptor<Map> eventTagCaptor = ArgumentCaptor.forClass(Map.class);
1187-
1188-
// verify that the event builder was called with the expected revenue
1189-
verify(mockEventBuilder).createConversionEvent(
1190-
eq(validProjectConfig),
1191-
eq(experimentVariationMap),
1192-
eq(genericUserId),
1193-
eq(eventType.getId()),
1194-
eq(eventType.getKey()),
1195-
eq(Collections.<String, String>emptyMap()),
1196-
eventTagCaptor.capture());
1197-
1198-
Long actualValue = (Long)eventTagCaptor.getValue().get(ReservedEventKey.REVENUE.toString());
1199-
assertThat(actualValue, is(revenue));
1200-
1201-
verify(mockEventHandler).dispatchEvent(logEventToDispatch);
1202-
}
1203-
12041143
/**
12051144
* Verify that {@link Optimizely#track(String, String, Map, Map)} passes event features to
12061145
* {@link EventBuilder#createConversionEvent(ProjectConfig, Map, String, String, String, Map, Map)}

0 commit comments

Comments
 (0)