@Test public void test_delete_profile() throws Exception { MixPanelOutputConnector mixPanelOutputConnector = new MixPanelOutputConnector() { @Override protected MixpanelAPI getMixpanelAPI() { return new MixpanelAPI(null, mockMixpanelServer.getServerURL() + "/engage"); } }; mixPanelOutputConnector.setPipelineContext(getMockPipelineContext()); mockMixpanelServer.addRequestResponse(new RequestResponse() .setExpectedRequestURI(mockMixpanelServer.getServerURL() + "/engage") .setExpectedRequestParam("data", "W3siJHRpbWUiOjEyNDU2MTM4ODUwMDAsIiRkaXN0aW5jdF9pZCI6IjUwNDc5YjI0NjcxYmYiLCIkZGVsZXRlIjoiIn1d") .setResponsePayload("1") ); mixPanelOutputConnector.deleteUserProfile(new JSONObject(SAMPLE_DELETE_PROFILE)); mockMixpanelServer.waitForAllRequestsToComplete(); mockMixpanelServer.assertAllRequestsCompleteOK(); }
protected void deleteUserProfile(JSONObject payload) throws JSONException, IOException { MixpanelAPI mixpanel = getMixpanelAPI(); MessageBuilder messageBuilder = new MessageBuilder(token); String distinct_id = payload.getString("distinct_id"); JSONObject mixPanelMessage = messageBuilder.set(distinct_id, null); JSONUtil.removeValue(mixPanelMessage, "message", "$set"); JSONUtil.setValue(mixPanelMessage, "", "message", "$delete"); Long time = payload.optLong("time", 0L); if (time != 0L) { JSONUtil.setValue(mixPanelMessage, time, "message", "$time"); } sendMessageToMixpanel(mixpanel, mixPanelMessage); }
MixPanelOutputConnector extends AbstractPipelineComponent implements OutputConnector, Configurable<JSONObject> { protected void deleteUserProfile(JSONObject payload) throws JSONException, IOException { MixpanelAPI mixpanel = getMixpanelAPI(); MessageBuilder messageBuilder = new MessageBuilder(token); String distinct_id = payload.getString("distinct_id"); JSONObject mixPanelMessage = messageBuilder.set(distinct_id, null); JSONUtil.removeValue(mixPanelMessage, "message", "$set"); JSONUtil.setValue(mixPanelMessage, "", "message", "$delete"); Long time = payload.optLong("time", 0L); if (time != 0L) { JSONUtil.setValue(mixPanelMessage, time, "message", "$time"); } sendMessageToMixpanel(mixpanel, mixPanelMessage); } }
MixPanelOutputConnector extends AbstractPipelineComponent implements OutputConnector, Configurable<JSONObject> { protected void deleteUserProfile(JSONObject payload) throws JSONException, IOException { MixpanelAPI mixpanel = getMixpanelAPI(); MessageBuilder messageBuilder = new MessageBuilder(token); String distinct_id = payload.getString("distinct_id"); JSONObject mixPanelMessage = messageBuilder.set(distinct_id, null); JSONUtil.removeValue(mixPanelMessage, "message", "$set"); JSONUtil.setValue(mixPanelMessage, "", "message", "$delete"); Long time = payload.optLong("time", 0L); if (time != 0L) { JSONUtil.setValue(mixPanelMessage, time, "message", "$time"); } sendMessageToMixpanel(mixpanel, mixPanelMessage); }  }
MixPanelOutputConnector extends AbstractPipelineComponent implements OutputConnector, Configurable<JSONObject> { protected void deleteUserProfile(JSONObject payload) throws JSONException, IOException { MixpanelAPI mixpanel = getMixpanelAPI(); MessageBuilder messageBuilder = new MessageBuilder(token); String distinct_id = payload.getString("distinct_id"); JSONObject mixPanelMessage = messageBuilder.set(distinct_id, null); JSONUtil.removeValue(mixPanelMessage, "message", "$set"); JSONUtil.setValue(mixPanelMessage, "", "message", "$delete"); Long time = payload.optLong("time", 0L); if (time != 0L) { JSONUtil.setValue(mixPanelMessage, time, "message", "$time"); } sendMessageToMixpanel(mixpanel, mixPanelMessage); }  @Override void setConfiguration(JSONObject jsonObject); @Override Message send(Message message); }
MixPanelOutputConnector extends AbstractPipelineComponent implements OutputConnector, Configurable<JSONObject> { protected void deleteUserProfile(JSONObject payload) throws JSONException, IOException { MixpanelAPI mixpanel = getMixpanelAPI(); MessageBuilder messageBuilder = new MessageBuilder(token); String distinct_id = payload.getString("distinct_id"); JSONObject mixPanelMessage = messageBuilder.set(distinct_id, null); JSONUtil.removeValue(mixPanelMessage, "message", "$set"); JSONUtil.setValue(mixPanelMessage, "", "message", "$delete"); Long time = payload.optLong("time", 0L); if (time != 0L) { JSONUtil.setValue(mixPanelMessage, time, "message", "$time"); } sendMessageToMixpanel(mixpanel, mixPanelMessage); }  @Override void setConfiguration(JSONObject jsonObject); @Override Message send(Message message);  }