2525import java .util .*;
2626import java .util .stream .Collectors ;
2727
28+ import static com .optimizely .ab .config .ProjectConfig .RESERVED_ATTRIBUTE_PREFIX ;
2829import static junit .framework .TestCase .assertTrue ;
2930import static org .junit .Assert .assertEquals ;
3031import static org .junit .Assert .fail ;
@@ -133,7 +134,7 @@ public void dispatchEvent(LogEvent logEvent) throws Exception {
133134 event .getKey (),
134135 visitor .getVisitorId (),
135136 visitor .getAttributes ().stream ()
136- .filter (attribute -> !attribute .getKey ().startsWith ("$" ))
137+ .filter (attribute -> !attribute .getKey ().startsWith (RESERVED_ATTRIBUTE_PREFIX ))
137138 .collect (Collectors .toMap (Attribute ::getKey , Attribute ::getValue ))
138139 );
139140
@@ -145,15 +146,15 @@ public void dispatchEvent(LogEvent logEvent) throws Exception {
145146 }
146147
147148 private static class CanonicalEvent {
148- private String experimentKey ;
149- private String variationKey ;
149+ private String experimentId ;
150+ private String variationId ;
150151 private String eventName ;
151152 private String visitorId ;
152153 private Map <String , ?> attributes ;
153154
154- public CanonicalEvent (String experimentKey , String variationKey , String eventName , String visitorId , Map <String , ?> attributes ) {
155- this .experimentKey = experimentKey ;
156- this .variationKey = variationKey ;
155+ public CanonicalEvent (String experimentId , String variationId , String eventName , String visitorId , Map <String , ?> attributes ) {
156+ this .experimentId = experimentId ;
157+ this .variationId = variationId ;
157158 this .eventName = eventName ;
158159 this .visitorId = visitorId ;
159160 this .attributes = attributes ;
@@ -164,23 +165,23 @@ public boolean equals(Object o) {
164165 if (this == o ) return true ;
165166 if (o == null || getClass () != o .getClass ()) return false ;
166167 CanonicalEvent that = (CanonicalEvent ) o ;
167- return Objects .equals (experimentKey , that .experimentKey ) &&
168- Objects .equals (variationKey , that .variationKey ) &&
168+ return Objects .equals (experimentId , that .experimentId ) &&
169+ Objects .equals (variationId , that .variationId ) &&
169170 Objects .equals (eventName , that .eventName ) &&
170171 Objects .equals (visitorId , that .visitorId ) &&
171172 Objects .equals (attributes , that .attributes );
172173 }
173174
174175 @ Override
175176 public int hashCode () {
176- return Objects .hash (experimentKey , variationKey , eventName , visitorId , attributes );
177+ return Objects .hash (experimentId , variationId , eventName , visitorId , attributes );
177178 }
178179
179180 @ Override
180181 public String toString () {
181182 return new StringJoiner (", " , CanonicalEvent .class .getSimpleName () + "[" , "]" )
182- .add ("experimentKey ='" + experimentKey + "'" )
183- .add ("variationKey ='" + variationKey + "'" )
183+ .add ("experimentId ='" + experimentId + "'" )
184+ .add ("variationId ='" + variationId + "'" )
184185 .add ("eventName='" + eventName + "'" )
185186 .add ("visitorId='" + visitorId + "'" )
186187 .add ("attributes=" + attributes )
0 commit comments