use of io.codekvast.common.customer.PricePlanDefaults in project codekvast by crispab.
the class MariadbIntegrationTest method assertConfigPollResponse.
private void assertConfigPollResponse(GetConfigResponse1 response, String publisherConfig) {
PricePlanDefaults pp = PricePlanDefaults.DEMO;
assertThat(response, is(GetConfigResponse1.sample().toBuilder().codeBasePublisherCheckIntervalSeconds(pp.getPublishIntervalSeconds()).codeBasePublisherConfig(publisherConfig).codeBasePublisherName("http").codeBasePublisherRetryIntervalSeconds(pp.getRetryIntervalSeconds()).configPollIntervalSeconds(pp.getPollIntervalSeconds()).configPollRetryIntervalSeconds(pp.getRetryIntervalSeconds()).invocationDataPublisherConfig(publisherConfig).invocationDataPublisherIntervalSeconds(pp.getPublishIntervalSeconds()).invocationDataPublisherName("http").invocationDataPublisherRetryIntervalSeconds(pp.getRetryIntervalSeconds()).build()));
}
use of io.codekvast.common.customer.PricePlanDefaults in project codekvast by crispab.
the class DashboardServiceImplTest method should_getStatus_after_trial_period.
@Test
public void should_getStatus_after_trial_period() {
// given
when(customerIdProvider.getCustomerId()).thenReturn(1L);
PricePlanDefaults ppd = PricePlanDefaults.TEST;
Instant collectionStartedAt = now.minus(3, DAYS);
Instant trialPeriodEndsAt = now.minus(1, MILLIS);
CustomerData customerData = CustomerData.builder().customerId(1L).customerName("customerName").pricePlan(PricePlan.of(ppd).toBuilder().retentionPeriodDays(-1).build()).source("source").collectionStartedAt(collectionStartedAt).trialPeriodEndsAt(trialPeriodEndsAt).build();
when(customerService.getCustomerDataByCustomerId(eq(1L))).thenReturn(customerData);
when(customerService.countMethods(eq(1L))).thenReturn(1000);
// when
GetStatusResponse status = dashboardService.getStatus();
// then
assertNotNull(status);
assertThat(status.getCollectedSinceMillis(), is(collectionStartedAt.toEpochMilli()));
assertThat(status.getTrialPeriodEndsAtMillis(), is(trialPeriodEndsAt.toEpochMilli()));
assertThat(status.getTrialPeriodPercent(), is(100));
assertThat(status.getTrialPeriodExpired(), is(true));
}
use of io.codekvast.common.customer.PricePlanDefaults in project codekvast by crispab.
the class IntakeIntegrationTest method assertConfigPollResponse.
private void assertConfigPollResponse(GetConfigResponse1 response) {
PricePlanDefaults pp = PricePlanDefaults.DEMO;
assertThat(response, is(GetConfigResponse1.sample().toBuilder().codeBasePublisherCheckIntervalSeconds(pp.getPublishIntervalSeconds()).codeBasePublisherConfig("enabled=true").codeBasePublisherName("http").codeBasePublisherRetryIntervalSeconds(pp.getRetryIntervalSeconds()).configPollIntervalSeconds(pp.getPollIntervalSeconds()).configPollRetryIntervalSeconds(pp.getRetryIntervalSeconds()).invocationDataPublisherConfig("enabled=true").invocationDataPublisherIntervalSeconds(pp.getPublishIntervalSeconds()).invocationDataPublisherName("http").invocationDataPublisherRetryIntervalSeconds(pp.getRetryIntervalSeconds()).build()));
}
Aggregations