test_class.declarator: mockMixpanelServer
test_class.modifier: private
test_class.original_string: private SimpleServer mockMixpanelServer;
test_class.type: SimpleServer
test_class.var_name: mockMixpanelServer
test_class.declarator: SAMPLE_SET_PROFILE = "{   \n" +
              "    \"distinct_id\": \"50479b24671bf\", \n" +
              "    \"ip\": \"127.0.0.1\", \n" +
              "    \"time\": 1245613885000, \n" +
              "    \"properties\": {\n" +
              "        \"Name\": \"Mark Downes\", \n" +
              "        \"Email\": \"md@x.com\"        \n" +
              "    }\n" +
              "}\n"
test_class.modifier: public static final
test_class.original_string: public static final String SAMPLE_SET_PROFILE = "{   \n" +
              "    \"distinct_id\": \"50479b24671bf\", \n" +
              "    \"ip\": \"127.0.0.1\", \n" +
              "    \"time\": 1245613885000, \n" +
              "    \"properties\": {\n" +
              "        \"Name\": \"Mark Downes\", \n" +
              "        \"Email\": \"md@x.com\"        \n" +
              "    }\n" +
              "}\n";
test_class.type: String
test_class.var_name: SAMPLE_SET_PROFILE
test_class.declarator: SAMPLE_EVENT = "{   \n" +
              "    \"event\": \"game\", \n" +
              "    \"properties\": {\n" +
              "        \"distinct_id\": \"50479b24671bf\", \n" +
              "        \"ip\": \"123.123.123.123\", \n" +
              "        \"token\": \"e3bc4100330c35722740fb8c6f5abddc\", \n" +
              "        \"time\": 1245613885000, \n" +
              "        \"action\": \"play\"        \n" +
              "    }\n" +
              "}\n"
test_class.modifier: public static final
test_class.original_string: public static final String SAMPLE_EVENT = "{   \n" +
              "    \"event\": \"game\", \n" +
              "    \"properties\": {\n" +
              "        \"distinct_id\": \"50479b24671bf\", \n" +
              "        \"ip\": \"123.123.123.123\", \n" +
              "        \"token\": \"e3bc4100330c35722740fb8c6f5abddc\", \n" +
              "        \"time\": 1245613885000, \n" +
              "        \"action\": \"play\"        \n" +
              "    }\n" +
              "}\n";
test_class.type: String
test_class.var_name: SAMPLE_EVENT
test_class.declarator: SAMPLE_DELETE_PROFILE = "{   \n" +
              "    \"distinct_id\": \"50479b24671bf\", \n" +
              "    \"time\": 1245613885000\n" +
              "}\n"
test_class.modifier: public static final
test_class.original_string: public static final String SAMPLE_DELETE_PROFILE = "{   \n" +
              "    \"distinct_id\": \"50479b24671bf\", \n" +
              "    \"time\": 1245613885000\n" +
              "}\n";
test_class.type: String
test_class.var_name: SAMPLE_DELETE_PROFILE
test_class.file: mixpanel/src/test/java/com/foxweave/connector/mixpanel/MixPanelOutputConnectorTest.java
test_class.identifier: MixPanelOutputConnectorTest
test_class.superclass: extends FoxWeaveTestCase
test_case.body: @Test
      public void test_set_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", "W3siJHRpbWUiOjEyNDU2MTM4ODUwMDAsIiRkaXN0aW5jdF9pZCI6IjUwNDc5YjI0NjcxYmYiLCIkc2V0Ijp7Ik5hbWUiOiJNYXJrIERvd25lcyIsIkVtYWlsIjoibWRAeC5jb20ifSwiJGlwIjoiMTI3LjAuMC4xIn1d")
                  .setResponsePayload("1")
          );
  
          mixPanelOutputConnector.setUserProfile(new JSONObject(SAMPLE_SET_PROFILE));
  
          mockMixpanelServer.waitForAllRequestsToComplete();
          mockMixpanelServer.assertAllRequestsCompleteOK();
      }
test_case.class_method_signature: MixPanelOutputConnectorTest.test_set_profile()
test_case.full_signature: @Test public void test_set_profile()
test_case.identifier: test_set_profile
test_case.invocations: getServerURL setPipelineContext getMockPipelineContext addRequestResponse setResponsePayload setExpectedRequestParam setExpectedRequestURI getServerURL setUserProfile waitForAllRequestsToComplete assertAllRequestsCompleteOK
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_set_profile()
focal_class.declarator: token
focal_class.modifier: private
focal_class.original_string: private String token;
focal_class.type: String
focal_class.var_name: token
focal_class.declarator: objectName
focal_class.modifier: private
focal_class.original_string: private String objectName;
focal_class.type: String
focal_class.var_name: objectName
focal_class.file: mixpanel/src/main/java/com/foxweave/connector/mixpanel/MixPanelOutputConnector.java
focal_class.identifier: MixPanelOutputConnector
focal_class.interfaces: implements OutputConnector, Configurable<JSONObject>
focal_class.class_method_signature: MixPanelOutputConnector.setConfiguration(JSONObject jsonObject)
focal_class.full_signature: @Override public void setConfiguration(JSONObject jsonObject)
focal_class.identifier: setConfiguration
focal_class.modifiers: @Override public
focal_class.parameters: (JSONObject jsonObject)
focal_class.return: void
focal_class.signature: void setConfiguration(JSONObject jsonObject)
focal_class.class_method_signature: MixPanelOutputConnector.send(Message message)
focal_class.full_signature: @Override public Message send(Message message)
focal_class.identifier: send
focal_class.modifiers: @Override public
focal_class.parameters: (Message message)
focal_class.return: Message
focal_class.signature: Message send(Message message)
focal_class.class_method_signature: MixPanelOutputConnector.logActivity(JSONObject payload)
focal_class.full_signature: protected void logActivity(JSONObject payload)
focal_class.identifier: logActivity
focal_class.modifiers: protected
focal_class.parameters: (JSONObject payload)
focal_class.return: void
focal_class.signature: void logActivity(JSONObject payload)
focal_class.class_method_signature: MixPanelOutputConnector.setUserProfile(JSONObject payload)
focal_class.full_signature: protected void setUserProfile(JSONObject payload)
focal_class.identifier: setUserProfile
focal_class.modifiers: protected
focal_class.parameters: (JSONObject payload)
focal_class.return: void
focal_class.signature: void setUserProfile(JSONObject payload)
focal_class.class_method_signature: MixPanelOutputConnector.deleteUserProfile(JSONObject payload)
focal_class.full_signature: protected void deleteUserProfile(JSONObject payload)
focal_class.identifier: deleteUserProfile
focal_class.modifiers: protected
focal_class.parameters: (JSONObject payload)
focal_class.return: void
focal_class.signature: void deleteUserProfile(JSONObject payload)
focal_class.class_method_signature: MixPanelOutputConnector.sendMessageToMixpanel(MixpanelAPI mixpanel, JSONObject mixPanelMessage)
focal_class.full_signature: private void sendMessageToMixpanel(MixpanelAPI mixpanel, JSONObject mixPanelMessage)
focal_class.identifier: sendMessageToMixpanel
focal_class.modifiers: private
focal_class.parameters: (MixpanelAPI mixpanel, JSONObject mixPanelMessage)
focal_class.return: void
focal_class.signature: void sendMessageToMixpanel(MixpanelAPI mixpanel, JSONObject mixPanelMessage)
focal_class.class_method_signature: MixPanelOutputConnector.getMixpanelAPI()
focal_class.full_signature: protected MixpanelAPI getMixpanelAPI()
focal_class.identifier: getMixpanelAPI
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: MixpanelAPI
focal_class.signature: MixpanelAPI getMixpanelAPI()
focal_class.superclass: extends AbstractPipelineComponent
focal_method.body: protected void setUserProfile(JSONObject payload) throws JSONException, IOException {
          // See https://mixpanel.com/help/reference/http#people-analytics-updates
  
          JSONObject properties = payload.optJSONObject("properties");
          MixpanelAPI mixpanel = getMixpanelAPI();
          MessageBuilder messageBuilder = new MessageBuilder(token);
  
          String distinct_id = payload.getString("distinct_id");
  
          if (properties == null) {
              properties = new JSONObject();
          }
          JSONObject mixPanelMessage = messageBuilder.set(distinct_id, properties);
  
          String ip = payload.optString("ip", null);
          if (ip != null) {
              JSONUtil.setValue(mixPanelMessage, ip, "message", "$ip");
          }
  
          Long time = payload.optLong("time", 0L);
          if (time != 0L) {
              JSONUtil.setValue(mixPanelMessage, time, "message", "$time");
          }
  
          sendMessageToMixpanel(mixpanel, mixPanelMessage);
      }
focal_method.class_method_signature: MixPanelOutputConnector.setUserProfile(JSONObject payload)
focal_method.full_signature: protected void setUserProfile(JSONObject payload)
focal_method.identifier: setUserProfile
focal_method.invocations: optJSONObject getMixpanelAPI getString set optString setValue optLong setValue sendMessageToMixpanel
focal_method.modifiers: protected
focal_method.parameters: (JSONObject payload)
focal_method.return: void
focal_method.signature: void setUserProfile(JSONObject payload)