@Test public void updateRunningExperiments_yesExperiments_callsAbt() throws Exception { abtIntegrationHelper.updateRunningExperiments(yesExperimentResponse); verify(abTesting).validateRunningExperiments(Mockito.any()); }
void updateRunningExperiments(FetchEligibleCampaignsResponse response) { ArrayList<AbtExperimentInfo> runningExperiments = new ArrayList<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { if (!content.getIsTestCampaign() && content .getPayloadCase() .equals(CampaignProto.ThickContent.PayloadCase.EXPERIMENTAL_PAYLOAD)) { FirebaseAbt.ExperimentPayload payload = content.getExperimentalPayload().getExperimentPayload(); runningExperiments.add( new AbtExperimentInfo( payload.getExperimentId(), payload.getVariantId(), payload.getTriggerEvent(), new Date(payload.getExperimentStartTimeMillis()), payload.getTriggerTimeoutMillis(), payload.getTimeToLiveMillis())); } } if (runningExperiments.isEmpty()) { return; } executor.execute( () -> { try { Logging.logd( "Updating running experiments with: " + runningExperiments.size() + " experiments"); abTesting.validateRunningExperiments(runningExperiments); } catch (AbtException e) { Logging.loge( "Unable to register experiments with ABT, missing analytics?\n" + e.getMessage()); } }); }
AbtIntegrationHelper { void updateRunningExperiments(FetchEligibleCampaignsResponse response) { ArrayList<AbtExperimentInfo> runningExperiments = new ArrayList<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { if (!content.getIsTestCampaign() && content .getPayloadCase() .equals(CampaignProto.ThickContent.PayloadCase.EXPERIMENTAL_PAYLOAD)) { FirebaseAbt.ExperimentPayload payload = content.getExperimentalPayload().getExperimentPayload(); runningExperiments.add( new AbtExperimentInfo( payload.getExperimentId(), payload.getVariantId(), payload.getTriggerEvent(), new Date(payload.getExperimentStartTimeMillis()), payload.getTriggerTimeoutMillis(), payload.getTimeToLiveMillis())); } } if (runningExperiments.isEmpty()) { return; } executor.execute( () -> { try { Logging.logd( "Updating running experiments with: " + runningExperiments.size() + " experiments"); abTesting.validateRunningExperiments(runningExperiments); } catch (AbtException e) { Logging.loge( "Unable to register experiments with ABT, missing analytics?\n" + e.getMessage()); } }); } }
AbtIntegrationHelper { void updateRunningExperiments(FetchEligibleCampaignsResponse response) { ArrayList<AbtExperimentInfo> runningExperiments = new ArrayList<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { if (!content.getIsTestCampaign() && content .getPayloadCase() .equals(CampaignProto.ThickContent.PayloadCase.EXPERIMENTAL_PAYLOAD)) { FirebaseAbt.ExperimentPayload payload = content.getExperimentalPayload().getExperimentPayload(); runningExperiments.add( new AbtExperimentInfo( payload.getExperimentId(), payload.getVariantId(), payload.getTriggerEvent(), new Date(payload.getExperimentStartTimeMillis()), payload.getTriggerTimeoutMillis(), payload.getTimeToLiveMillis())); } } if (runningExperiments.isEmpty()) { return; } executor.execute( () -> { try { Logging.logd( "Updating running experiments with: " + runningExperiments.size() + " experiments"); abTesting.validateRunningExperiments(runningExperiments); } catch (AbtException e) { Logging.loge( "Unable to register experiments with ABT, missing analytics?\n" + e.getMessage()); } }); } @Inject  AbtIntegrationHelper(FirebaseABTesting abTesting); }
AbtIntegrationHelper { void updateRunningExperiments(FetchEligibleCampaignsResponse response) { ArrayList<AbtExperimentInfo> runningExperiments = new ArrayList<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { if (!content.getIsTestCampaign() && content .getPayloadCase() .equals(CampaignProto.ThickContent.PayloadCase.EXPERIMENTAL_PAYLOAD)) { FirebaseAbt.ExperimentPayload payload = content.getExperimentalPayload().getExperimentPayload(); runningExperiments.add( new AbtExperimentInfo( payload.getExperimentId(), payload.getVariantId(), payload.getTriggerEvent(), new Date(payload.getExperimentStartTimeMillis()), payload.getTriggerTimeoutMillis(), payload.getTimeToLiveMillis())); } } if (runningExperiments.isEmpty()) { return; } executor.execute( () -> { try { Logging.logd( "Updating running experiments with: " + runningExperiments.size() + " experiments"); abTesting.validateRunningExperiments(runningExperiments); } catch (AbtException e) { Logging.loge( "Unable to register experiments with ABT, missing analytics?\n" + e.getMessage()); } }); } @Inject  AbtIntegrationHelper(FirebaseABTesting abTesting);  }
AbtIntegrationHelper { void updateRunningExperiments(FetchEligibleCampaignsResponse response) { ArrayList<AbtExperimentInfo> runningExperiments = new ArrayList<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { if (!content.getIsTestCampaign() && content .getPayloadCase() .equals(CampaignProto.ThickContent.PayloadCase.EXPERIMENTAL_PAYLOAD)) { FirebaseAbt.ExperimentPayload payload = content.getExperimentalPayload().getExperimentPayload(); runningExperiments.add( new AbtExperimentInfo( payload.getExperimentId(), payload.getVariantId(), payload.getTriggerEvent(), new Date(payload.getExperimentStartTimeMillis()), payload.getTriggerTimeoutMillis(), payload.getTimeToLiveMillis())); } } if (runningExperiments.isEmpty()) { return; } executor.execute( () -> { try { Logging.logd( "Updating running experiments with: " + runningExperiments.size() + " experiments"); abTesting.validateRunningExperiments(runningExperiments); } catch (AbtException e) { Logging.loge( "Unable to register experiments with ABT, missing analytics?\n" + e.getMessage()); } }); } @Inject  AbtIntegrationHelper(FirebaseABTesting abTesting);   }