@Test public void testMultiHashProjections1() throws Exception { KitConfiguration kitConfiguration = MockKitConfiguration.createKitConfiguration(new JSONObject("{\"id\":56, \"as\":{}, \"hs\":{}, \"pr\":[{\"id\":93, \"pmmid\":23, \"matches\":[{\"message_type\":4, \"event_match_type\":\"String\", \"event\":\"Product View\", \"attribute_key\":\"$MethodName\", \"attribute_values\":\"$ProductView\"}], \"behavior\":{\"max_custom_params\":0 }, \"action\":{\"projected_event_name\":\"cool_product_view\"} }, {\"id\":89, \"matches\":[{\"message_type\":4, \"event_match_type\":\"\", \"event\":\"\"}], \"behavior\":{\"append_unmapped_as_is\":true, \"is_default\":true }, \"action\":{\"projected_event_name\":\"\", \"attribute_maps\":[] } }, {\"id\":100, \"pmid\":179, \"matches\":[{\"message_type\":4, \"event_match_type\":\"Hash\", \"event\":\"178531468\"}], \"behavior\":{\"max_custom_params\":10, \"append_unmapped_as_is\":true }, \"action\":{\"projected_event_name\":\"account - check order status\", \"attribute_maps\":[] } }, {\"id\":92, \"pmid\":182, \"matches\":[{\"message_type\":4, \"event_match_type\":\"Hash\", \"event\":\"1111995177\"}], \"behavior\":{\"max_custom_params\":0 }, \"action\":{\"projected_event_name\":\"account - feedback\", \"attribute_maps\":[{\"projected_attribute_name\":\"Feedback Type\", \"match_type\":\"Hash\", \"value\":\"-768380952\", \"data_type\":\"String\"} ] } }, {\"id\":96, \"pmid\":183, \"matches\":[{\"message_type\":4, \"event_match_type\":\"Hash\", \"event\":\"178531468\"}], \"behavior\":{\"max_custom_params\":0 }, \"action\":{\"projected_event_name\":\"pdp - add to tote\", \"attribute_maps\":[{\"projected_attribute_name\":\"Last Add to Tote Name\", \"match_type\":\"Hash\", \"value\":\"102582760\", \"data_type\":\"String\"}, {\"projected_attribute_name\":\"Last Add to Tote Print\", \"match_type\":\"Hash\", \"value\":\"102582760\", \"data_type\":\"String\"}, {\"projected_attribute_name\":\"Last Add to Tote Category\", \"match_type\":\"Hash\", \"value\":\"111828069\", \"data_type\":\"String\", \"is_required\":true }, {\"projected_attribute_name\":\"Last Add to Tote Total Amount\", \"match_type\":\"Hash\", \"value\":\"111828069\", \"data_type\":\"String\"}, {\"projected_attribute_name\":\"Last Add to Tote SKU\", \"match_type\":\"Hash\", \"value\":\"111828069\", \"data_type\":\"String\"}, {\"projected_attribute_name\":\"Last Add to Tote Size\", \"match_type\":\"Hash\", \"value\":\"111828069\", \"data_type\":\"String\"}, {\"projected_attribute_name\":\"Last Add to Tote Quantity\", \"match_type\":\"Static\", \"value\":\"10\", \"data_type\":\"Int\"}, {\"projected_attribute_name\":\"Last Add to Tote Unit Price\", \"match_type\":\"Static\", \"value\":\"1321\", \"data_type\":\"String\"} ] } }, {\"id\":104, \"pmid\":184, \"matches\":[{\"message_type\":4, \"event_match_type\":\"Hash\", \"event\":\"178531468\"}], \"behavior\":{\"max_custom_params\":0 }, \"action\":{\"projected_event_name\":\"pdp - complete the look\", \"attribute_maps\":[{\"projected_attribute_name\":\"Complete the Look Product Name\", \"match_type\":\"Hash\", \"value\":\"111828069\", \"data_type\":\"String\"}, {\"projected_attribute_name\":\"Complete the Look Product Name 2\", \"match_type\":\"Hash\", \"value\":\"102582760\", \"data_type\":\"String\", \"is_required\":true } ] } }, {\"id\":104, \"pmid\":185, \"matches\":[{\"message_type\":4, \"event_match_type\":\"Hash\", \"event\":\"987878094\"}], \"behavior\":{\"max_custom_params\":0 }, \"action\":{\"projected_event_name\":\"pdp - complete the look\", \"attribute_maps\":[{\"projected_attribute_name\":\"Complete the Look Product Name\", \"match_type\":\"Hash\", \"value\":\"689388774\", \"data_type\":\"String\"} ] } }, {\"id\":104, \"pmid\":186, \"matches\":[{\"message_type\":4, \"event_match_type\":\"Hash\", \"event\":\"-754932241\"}], \"behavior\":{\"max_custom_params\":0 }, \"action\":{\"projected_event_name\":\"pdp - complete the look\", \"attribute_maps\":[{\"projected_attribute_name\":\"Complete the Look Product Name\", \"match_type\":\"Hash\", \"value\":\"992037090\", \"data_type\":\"String\"} ] } } ] }")); MPEvent.Builder builder = new MPEvent.Builder("sproj 1", MParticle.EventType.UserContent); Map<String, String> attributes = new HashMap<String, String>(); attributes.put("attribute we don't care about", "some value"); builder.customAttributes(attributes); List<CustomMapping.ProjectionResult> eventList = CustomMapping.projectEvents(builder.build(), kitConfiguration.getCustomMappingList(), kitConfiguration.getDefaultEventProjection()); assertEquals(1, eventList.size()); MPEvent projEvent1 = eventList.get(0).getMPEvent(); assertEquals("account - check order status", projEvent1.getEventName()); assertEquals("some value", projEvent1.getCustomAttributes().get("attribute we don't care about")); }
public static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping) { return projectEvents(event, false, customMappingList, defaultCustomMapping, null); }
CustomMapping { public static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping) { return projectEvents(event, false, customMappingList, defaultCustomMapping, null); } }
CustomMapping { public static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping) { return projectEvents(event, false, customMappingList, defaultCustomMapping, null); } CustomMapping(JSONObject projectionJson); }
CustomMapping { public static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping) { return projectEvents(event, false, customMappingList, defaultCustomMapping, null); } CustomMapping(JSONObject projectionJson); List<CustomMappingMatch> getMatchList(); boolean isDefault(); List<ProjectionResult> project(EventWrapper.CommerceEventWrapper commerceEventWrapper); List<ProjectionResult> project(EventWrapper.MPEventWrapper event); int getMessageType(); static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping); static List<CustomMapping.ProjectionResult> projectEvents(CommerceEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCommerceCustomMapping); static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, boolean isScreenEvent, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping, CustomMapping defaultScreenCustomMapping); }
CustomMapping { public static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping) { return projectEvents(event, false, customMappingList, defaultCustomMapping, null); } CustomMapping(JSONObject projectionJson); List<CustomMappingMatch> getMatchList(); boolean isDefault(); List<ProjectionResult> project(EventWrapper.CommerceEventWrapper commerceEventWrapper); List<ProjectionResult> project(EventWrapper.MPEventWrapper event); int getMessageType(); static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping); static List<CustomMapping.ProjectionResult> projectEvents(CommerceEvent event, List<CustomMapping> customMappingList, CustomMapping defaultCommerceCustomMapping); static List<CustomMapping.ProjectionResult> projectEvents(MPEvent event, boolean isScreenEvent, List<CustomMapping> customMappingList, CustomMapping defaultCustomMapping, CustomMapping defaultScreenCustomMapping); final static String PROPERTY_LOCATION_EVENT_FIELD; final static String PROPERTY_LOCATION_EVENT_ATTRIBUTE; final static String PROPERTY_LOCATION_PRODUCT_FIELD; final static String PROPERTY_LOCATION_PRODUCT_ATTRIBUTE; final static String PROPERTY_LOCATION_PROMOTION_FIELD; }